diff options
author | Eric Caruso <ejcaruso@google.com> | 2016-06-23 11:29:08 -0700 |
---|---|---|
committer | Eric Caruso <ejcaruso@google.com> | 2016-06-23 11:29:08 -0700 |
commit | e04b064a46c958fc5d82dfbce82706ffaeeb023d (patch) | |
tree | f393dfe742e8d9df470a3705f89316332ad794e9 | |
parent | c65e95eb7742f228e495f44c1ce03f7de8b7c6d1 (diff) | |
download | shill-e04b064a46c958fc5d82dfbce82706ffaeeb023d.tar.gz |
device: remove ScanType enum
This only has one value and has been useless since the
removal of progressive scan, so we can get rid of it.
BUG=chromium:611492
TEST=make, unit tests
Change-Id: I287adcbdfe323848630686b3957f9faad550fbe9
-rw-r--r-- | binder/manager_binder_adaptor.cc | 2 | ||||
-rw-r--r-- | cellular/cellular.cc | 3 | ||||
-rw-r--r-- | cellular/cellular.h | 3 | ||||
-rw-r--r-- | cellular/cellular_unittest.cc | 6 | ||||
-rw-r--r-- | dbus/chromeos_device_dbus_adaptor.cc | 2 | ||||
-rw-r--r-- | dbus/chromeos_manager_dbus_adaptor.cc | 2 | ||||
-rw-r--r-- | device.cc | 2 | ||||
-rw-r--r-- | device.h | 5 | ||||
-rw-r--r-- | manager.cc | 5 | ||||
-rw-r--r-- | manager.h | 3 | ||||
-rw-r--r-- | manager_unittest.cc | 16 | ||||
-rw-r--r-- | mock_device.h | 3 | ||||
-rw-r--r-- | mock_manager.h | 3 | ||||
-rw-r--r-- | wifi/mock_wifi.h | 3 | ||||
-rw-r--r-- | wifi/wifi.cc | 14 | ||||
-rw-r--r-- | wifi/wifi.h | 4 | ||||
-rw-r--r-- | wifi/wifi_provider.cc | 2 | ||||
-rw-r--r-- | wifi/wifi_provider_unittest.cc | 9 | ||||
-rw-r--r-- | wifi/wifi_unittest.cc | 4 | ||||
-rw-r--r-- | wimax/wimax.cc | 3 | ||||
-rw-r--r-- | wimax/wimax.h | 3 |
21 files changed, 42 insertions, 55 deletions
diff --git a/binder/manager_binder_adaptor.cc b/binder/manager_binder_adaptor.cc index e7f17615..f5eb657b 100644 --- a/binder/manager_binder_adaptor.cc +++ b/binder/manager_binder_adaptor.cc @@ -247,7 +247,7 @@ Status ManagerBinderAdaptor::RequestScan(int32_t type) { SLOG(this, 2) << __func__ << ": " << technology; Error e; - manager_->RequestScan(Device::kFullScan, technology, &e); + manager_->RequestScan(technology, &e); return e.ToBinderStatus(); } diff --git a/cellular/cellular.cc b/cellular/cellular.cc index e3b592a2..f465ab0b 100644 --- a/cellular/cellular.cc +++ b/cellular/cellular.cc @@ -533,8 +533,7 @@ void Cellular::OnAfterResume() { Device::OnAfterResume(); } -void Cellular::Scan(ScanType /*scan_type*/, Error* error, - const string& /*reason*/) { +void Cellular::Scan(Error* error, const string& /*reason*/) { SLOG(this, 2) << __func__; CHECK(error); if (proposed_scan_in_progress_) { diff --git a/cellular/cellular.h b/cellular/cellular.h index 05c735dc..e0ee4f05 100644 --- a/cellular/cellular.h +++ b/cellular/cellular.h @@ -175,8 +175,7 @@ class Cellular : public Device, public RPCTaskDelegate { const EnabledStateChangedCallback& callback) override; void Stop(Error* error, const EnabledStateChangedCallback& callback) override; void LinkEvent(unsigned int flags, unsigned int change) override; - void Scan(ScanType /*scan_type*/, Error* error, - const std::string& /*reason*/) override; + void Scan(Error* error, const std::string& /*reason*/) override; void RegisterOnNetwork(const std::string& network_id, Error* error, const ResultCallback& callback) override; diff --git a/cellular/cellular_unittest.cc b/cellular/cellular_unittest.cc index 328ef353..f750bf4b 100644 --- a/cellular/cellular_unittest.cc +++ b/cellular/cellular_unittest.cc @@ -2011,7 +2011,7 @@ TEST_F(CellularTest, ScanImmediateFailure) { // Warning: The test loses all references to the proxies when |InitProxies| is // called. GetCapabilityGSM()->InitProxies(); - device_->Scan(Device::kFullScan, &error, ""); + device_->Scan(&error, ""); EXPECT_TRUE(error.IsFailure()); EXPECT_FALSE(device_->scanning_); EXPECT_EQ(kTestNetworksCellular, device_->found_networks()); @@ -2031,7 +2031,7 @@ TEST_F(CellularTest, ScanAsynchronousFailure) { // Warning: The test loses all references to the proxies when |InitProxies| is // called. GetCapabilityGSM()->InitProxies(); - device_->Scan(Device::kFullScan, &error, ""); + device_->Scan(&error, ""); EXPECT_TRUE(error.IsOngoing()); EXPECT_TRUE(device_->scanning_); @@ -2056,7 +2056,7 @@ TEST_F(CellularTest, ScanSuccess) { // Warning: The test loses all references to the proxies when |InitProxies| is // called. GetCapabilityGSM()->InitProxies(); - device_->Scan(Device::kFullScan, &error, ""); + device_->Scan(&error, ""); EXPECT_TRUE(error.IsOngoing()); EXPECT_TRUE(device_->scanning_); diff --git a/dbus/chromeos_device_dbus_adaptor.cc b/dbus/chromeos_device_dbus_adaptor.cc index 01dee6cd..d72a0b3c 100644 --- a/dbus/chromeos_device_dbus_adaptor.cc +++ b/dbus/chromeos_device_dbus_adaptor.cc @@ -180,7 +180,7 @@ bool ChromeosDeviceDBusAdaptor::ProposeScan(brillo::ErrorPtr* error) { // User scan requests, which are the likely source of DBus requests, probably // aren't time-critical so we might as well perform a complete scan. It // also provides a failsafe for progressive scan. - device_->Scan(Device::kFullScan, &e, __func__); + device_->Scan(&e, __func__); return !e.ToChromeosError(error); } diff --git a/dbus/chromeos_manager_dbus_adaptor.cc b/dbus/chromeos_manager_dbus_adaptor.cc index 62a9f02a..0aea07ea 100644 --- a/dbus/chromeos_manager_dbus_adaptor.cc +++ b/dbus/chromeos_manager_dbus_adaptor.cc @@ -225,7 +225,7 @@ bool ChromeosManagerDBusAdaptor::RequestScan(brillo::ErrorPtr* error, const string& technology) { // NOLINT SLOG(this, 2) << __func__ << ": " << technology; Error e; - manager_->RequestScan(Device::kFullScan, technology, &e); + manager_->RequestScan(technology, &e); return !e.ToChromeosError(error); } @@ -255,7 +255,7 @@ void Device::LinkEvent(unsigned flags, unsigned change) { << std::dec << std::noshowbase; } -void Device::Scan(ScanType scan_type, Error* error, const string& reason) { +void Device::Scan(Error* error, const string& reason) { SLOG(this, 2) << __func__ << " [Device] on " << link_name() << " from " << reason; Error::PopulateAndLog(FROM_HERE, error, Error::kNotSupported, @@ -62,8 +62,6 @@ class TrafficMonitor; // this class. class Device : public base::RefCounted<Device> { public: - enum ScanType { kFullScan }; - // A constructor for the Device object Device(ControlInterface* control_interface, EventDispatcher* dispatcher, @@ -121,8 +119,7 @@ class Device : public base::RefCounted<Device> { virtual void LinkEvent(unsigned flags, unsigned change); // The default implementation sets |error| to kNotSupported. - virtual void Scan(ScanType scan_type, Error* error, - const std::string& reason); + virtual void Scan(Error* error, const std::string& reason); // The default implementation sets |error| to kNotSupported. virtual void SetSchedScan(bool enable, Error* error); virtual void RegisterOnNetwork(const std::string& network_id, Error* error, @@ -2602,12 +2602,11 @@ void Manager::RecheckPortalOnService(const ServiceRefPtr& service) { } } -void Manager::RequestScan(Device::ScanType scan_type, - const string& technology, Error* error) { +void Manager::RequestScan(const string& technology, Error* error) { if (technology == kTypeWifi || technology == "") { for (const auto& wifi_device : FilterByTechnology(Technology::kWifi)) { metrics_->NotifyUserInitiatedEvent(Metrics::kUserInitiatedEventWifiScan); - wifi_device->Scan(scan_type, error, __func__); + wifi_device->Scan(error, __func__); } } else { // TODO(quiche): support scanning for other technologies? @@ -209,8 +209,7 @@ class Manager : public base::SupportsWeakPtr<Manager> { // |service|. virtual void RecheckPortalOnService(const ServiceRefPtr& service); - virtual void RequestScan(Device::ScanType scan_type, - const std::string& technology, Error* error); + virtual void RequestScan(const std::string& technology, Error* error); // Configure scheduled scan for wifi devices. virtual void SetSchedScan(bool enable, Error* error); std::string GetTechnologyOrder(); diff --git a/manager_unittest.cc b/manager_unittest.cc index 7b1bd6a7..fbed9678 100644 --- a/manager_unittest.cc +++ b/manager_unittest.cc @@ -1616,13 +1616,13 @@ TEST_F(ManagerTest, RequestScan) { manager()->RegisterDevice(mock_devices_[1].get()); EXPECT_CALL(*mock_devices_[0], technology()) .WillRepeatedly(Return(Technology::kWifi)); - EXPECT_CALL(*mock_devices_[0], Scan(Device::kFullScan, _, _)); + EXPECT_CALL(*mock_devices_[0], Scan(_, _)); EXPECT_CALL(*mock_devices_[1], technology()) .WillRepeatedly(Return(Technology::kUnknown)); - EXPECT_CALL(*mock_devices_[1], Scan(_, _, _)).Times(0); + EXPECT_CALL(*mock_devices_[1], Scan(_, _)).Times(0); EXPECT_CALL(*metrics(), NotifyUserInitiatedEvent( Metrics::kUserInitiatedEventWifiScan)).Times(1); - manager()->RequestScan(Device::kFullScan, kTypeWifi, &error); + manager()->RequestScan(kTypeWifi, &error); manager()->DeregisterDevice(mock_devices_[0].get()); manager()->DeregisterDevice(mock_devices_[1].get()); Mock::VerifyAndClearExpectations(mock_devices_[0].get()); @@ -1633,8 +1633,8 @@ TEST_F(ManagerTest, RequestScan) { .WillRepeatedly(Return(Technology::kWifi)); EXPECT_CALL(*metrics(), NotifyUserInitiatedEvent( Metrics::kUserInitiatedEventWifiScan)).Times(1); - EXPECT_CALL(*mock_devices_[0], Scan(Device::kFullScan, _, _)); - manager()->RequestScan(Device::kFullScan, kTypeWifi, &error); + EXPECT_CALL(*mock_devices_[0], Scan(_, _)); + manager()->RequestScan(kTypeWifi, &error); manager()->DeregisterDevice(mock_devices_[0].get()); Mock::VerifyAndClearExpectations(mock_devices_[0].get()); @@ -1643,15 +1643,15 @@ TEST_F(ManagerTest, RequestScan) { .WillRepeatedly(Return(Technology::kUnknown)); EXPECT_CALL(*metrics(), NotifyUserInitiatedEvent( Metrics::kUserInitiatedEventWifiScan)).Times(0); - EXPECT_CALL(*mock_devices_[0], Scan(_, _, _)).Times(0); - manager()->RequestScan(Device::kFullScan, kTypeWifi, &error); + EXPECT_CALL(*mock_devices_[0], Scan(_, _)).Times(0); + manager()->RequestScan(kTypeWifi, &error); manager()->DeregisterDevice(mock_devices_[0].get()); Mock::VerifyAndClearExpectations(mock_devices_[0].get()); } { Error error; - manager()->RequestScan(Device::kFullScan, "bogus_device_type", &error); + manager()->RequestScan("bogus_device_type", &error); EXPECT_EQ(Error::kInvalidArguments, error.type()); } } diff --git a/mock_device.h b/mock_device.h index c0a5dd89..d543ed41 100644 --- a/mock_device.h +++ b/mock_device.h @@ -51,8 +51,7 @@ class MockDevice : public Device { MOCK_METHOD3(SetEnabledNonPersistent, void(bool enable, Error* error, const ResultCallback& callback)); - MOCK_METHOD3(Scan, void(Device::ScanType scan_type, Error* error, - const std::string& reason)); + MOCK_METHOD2(Scan, void(Error* error, const std::string& reason)); MOCK_METHOD1(Load, bool(StoreInterface* storage)); MOCK_METHOD1(Save, bool(StoreInterface* storage)); MOCK_METHOD0(DisableIPv6, void()); diff --git a/mock_manager.h b/mock_manager.h index b6bf474c..73a7aa6d 100644 --- a/mock_manager.h +++ b/mock_manager.h @@ -89,8 +89,7 @@ class MockManager : public Manager { MOCK_CONST_METHOD1(IsTechnologyAutoConnectDisabled, bool(Technology::Identifier tech)); MOCK_CONST_METHOD1(IsDefaultProfile, bool(const StoreInterface* storage)); - MOCK_METHOD3(RequestScan, void(Device::ScanType request_origin, - const std::string& technology, Error* error)); + MOCK_METHOD2(RequestScan, void(const std::string& technology, Error* error)); MOCK_CONST_METHOD0(GetPortalCheckURL, const std::string&()); MOCK_CONST_METHOD0(GetPortalCheckInterval, int()); MOCK_METHOD0(IsSuspending, bool()); diff --git a/wifi/mock_wifi.h b/wifi/mock_wifi.h index 167cae46..0320bcbb 100644 --- a/wifi/mock_wifi.h +++ b/wifi/mock_wifi.h @@ -50,8 +50,7 @@ class MockWiFi : public WiFi { const EnabledStateChangedCallback& callback)); MOCK_METHOD2(Stop, void(Error* error, const EnabledStateChangedCallback& callback)); - MOCK_METHOD3(Scan, void(ScanType scan_type, Error* error, - const std::string& reason)); + MOCK_METHOD2(Scan, void(Error* error, const std::string& reason)); MOCK_METHOD1(DisconnectFromIfActive, void(WiFiService* service)); MOCK_METHOD1(DisconnectFrom, void(WiFiService* service)); MOCK_METHOD1(ClearCachedCredentials, void(const WiFiService* service)); diff --git a/wifi/wifi.cc b/wifi/wifi.cc index 9bcda61a..d22270f2 100644 --- a/wifi/wifi.cc +++ b/wifi/wifi.cc @@ -323,7 +323,7 @@ void WiFi::Stop(Error* error, const EnabledStateChangedCallback& /*callback*/) { << endpoint_by_rpcid_.size() << " EndpointMap entries."; } -void WiFi::Scan(ScanType /* scan_type */, Error* /*error*/, const string& reason) { +void WiFi::Scan(Error* /*error*/, const string& reason) { if ((scan_state_ != kScanIdle) || (current_service_.get() && current_service_->IsConnecting())) { SLOG(this, 2) << "Ignoring scan request while scanning or connecting."; @@ -820,7 +820,7 @@ void WiFi::CurrentBSSChanged(const string& new_bss) { // We may want to reconsider this immediate scan, if/when shill // takes greater responsibility for scanning (vs. letting // supplicant handle most of it). - Scan(kFullScan, nullptr, __func__); + Scan(nullptr, __func__); } } else { HandleRoam(new_bss); @@ -1882,7 +1882,7 @@ void WiFi::OnAfterResume() { need_bss_flush_ = true; if (!IsConnectedToCurrentService()) { - InitiateScan(kFullScan); + InitiateScan(); } // Since we stopped the scan timer before suspending, start it again here. @@ -1899,7 +1899,7 @@ void WiFi::AbortScan() { SetScanState(kScanIdle, kScanMethodNone, __func__); } -void WiFi::InitiateScan(ScanType scan_type) { +void WiFi::InitiateScan() { LOG(INFO) << __func__; // Abort any current scan (at the shill-level; let any request that's // already gone out finish) since we don't know when it started. @@ -1907,7 +1907,7 @@ void WiFi::InitiateScan(ScanType scan_type) { if (IsIdle()) { // Not scanning/connecting/connected, so let's get things rolling. - Scan(scan_type, nullptr, __func__); + Scan(nullptr, __func__); RestartFastScanAttempts(); } else { SLOG(this, 1) << __func__ @@ -2063,7 +2063,7 @@ void WiFi::ScanTimerHandler() { return; } if (scan_state_ == kScanIdle && IsIdle()) { - Scan(kFullScan, nullptr, __func__); + Scan(nullptr, __func__); if (fast_scans_remaining_ > 0) { --fast_scans_remaining_; } @@ -2341,7 +2341,7 @@ void WiFi::ConnectToSupplicant() { << "May be running an older version of wpa_supplicant."; } - Scan(kFullScan, nullptr, __func__); + Scan(nullptr, __func__); StartScanTimer(); } diff --git a/wifi/wifi.h b/wifi/wifi.h index bde5fbaf..7e1530f2 100644 --- a/wifi/wifi.h +++ b/wifi/wifi.h @@ -144,7 +144,7 @@ class WiFi : public Device, public SupplicantEventDelegateInterface { void Start(Error* error, const EnabledStateChangedCallback& callback) override; void Stop(Error* error, const EnabledStateChangedCallback& callback) override; - void Scan(ScanType scan_type, Error* error, const std::string& reason) override; + void Scan(Error* error, const std::string& reason) override; void SetSchedScan(bool enable, Error* error) override; // Callback for system suspend. void OnBeforeSuspend(const ResultCallback& callback) override; @@ -521,7 +521,7 @@ class WiFi : public Device, public SupplicantEventDelegateInterface { void AbortScan(); // Abort any current scan and start a new scan of type |type| if shill is // currently idle. - void InitiateScan(ScanType scan_type); + void InitiateScan(); // Suppresses manager auto-connects and flushes supplicant BSS cache, then // triggers the passive scan. Meant for use in dark resume where we want to // ensure that shill and supplicant do not use stale information to launch diff --git a/wifi/wifi_provider.cc b/wifi/wifi_provider.cc index 53e5a1be..c23ae146 100644 --- a/wifi/wifi_provider.cc +++ b/wifi/wifi_provider.cc @@ -161,7 +161,7 @@ void WiFiProvider::CreateServicesFromProfile(const ProfileRefPtr& profile) { if (created_hidden_service && !manager_->IsTechnologyConnected(Technology::kWifi)) { Error unused_error; - manager_->RequestScan(Device::kFullScan, kTypeWifi, &unused_error); + manager_->RequestScan(kTypeWifi, &unused_error); } ReportRememberedNetworkCount(); diff --git a/wifi/wifi_provider_unittest.cc b/wifi/wifi_provider_unittest.cc index 5b01805a..4f874e9f 100644 --- a/wifi/wifi_provider_unittest.cc +++ b/wifi/wifi_provider_unittest.cc @@ -679,7 +679,7 @@ TEST_F(WiFiProviderTest, CreateServicesFromProfileHiddenButConnected) { EXPECT_CALL(manager_, IsServiceEphemeral(_)).WillRepeatedly(Return(false)); EXPECT_CALL(manager_, IsTechnologyConnected(Technology::kWifi)) .WillOnce(Return(true)); - EXPECT_CALL(manager_, RequestScan(_, _, _)).Times(0); + EXPECT_CALL(manager_, RequestScan(_, _)).Times(0); EXPECT_CALL(metrics_, SendToUMA( Metrics::kMetricRememberedWiFiNetworkCount, 1, @@ -708,8 +708,7 @@ TEST_F(WiFiProviderTest, CreateServicesFromProfileHiddenNotConnected) { EXPECT_CALL(manager_, IsServiceEphemeral(_)).WillRepeatedly(Return(false)); EXPECT_CALL(manager_, IsTechnologyConnected(Technology::kWifi)) .WillOnce(Return(false)); - EXPECT_CALL(manager_, RequestScan(Device::kFullScan, - kTypeWifi, _)).Times(1); + EXPECT_CALL(manager_, RequestScan(kTypeWifi, _)).Times(1); EXPECT_CALL(metrics_, SendToUMA( Metrics::kMetricRememberedWiFiNetworkCount, 1, @@ -721,7 +720,7 @@ TEST_F(WiFiProviderTest, CreateServicesFromProfileHiddenNotConnected) { EXPECT_CALL(manager_, RegisterService(_)).Times(0); EXPECT_CALL(manager_, IsTechnologyConnected(_)).Times(0); - EXPECT_CALL(manager_, RequestScan(_, _, _)).Times(0); + EXPECT_CALL(manager_, RequestScan(_, _)).Times(0); EXPECT_CALL(manager_, IsServiceEphemeral(_)).WillRepeatedly(Return(false)); CreateServicesFromProfile(default_profile_.get()); } @@ -823,7 +822,7 @@ TEST_F(WiFiProviderTest, CreateTwoServices) { EXPECT_CALL(manager_, IsServiceEphemeral(_)).WillRepeatedly(Return(false)); EXPECT_CALL(manager_, IsTechnologyConnected(Technology::kWifi)) .WillOnce(Return(true)); - EXPECT_CALL(manager_, RequestScan(_, kTypeWifi, _)).Times(0); + EXPECT_CALL(manager_, RequestScan(kTypeWifi, _)).Times(0); EXPECT_CALL(metrics_, SendToUMA( Metrics::kMetricRememberedWiFiNetworkCount, 2, diff --git a/wifi/wifi_unittest.cc b/wifi/wifi_unittest.cc index 9d032ab9..72541906 100644 --- a/wifi/wifi_unittest.cc +++ b/wifi/wifi_unittest.cc @@ -917,7 +917,7 @@ class WiFiObjectTest : public ::testing::TestWithParam<string> { wifi_->ScanTimerHandler(); } void TriggerScan() { - wifi_->Scan(Device::kFullScan, nullptr, __func__); + wifi_->Scan(nullptr, __func__); } const WiFiServiceRefPtr& GetCurrentService() { return wifi_->current_service_; @@ -1114,7 +1114,7 @@ class WiFiObjectTest : public ::testing::TestWithParam<string> { wifi_->RemoveSupplicantNetworks(); } void InitiateScan() { - wifi_->InitiateScan(Device::kFullScan); + wifi_->InitiateScan(); } void InitiateScanInDarkResume(const WiFi::FreqSet& freqs) { wifi_->InitiateScanInDarkResume(freqs); diff --git a/wimax/wimax.cc b/wimax/wimax.cc index 02e0a3d7..4dc738cd 100644 --- a/wimax/wimax.cc +++ b/wimax/wimax.cc @@ -126,8 +126,7 @@ void WiMax::Stop(Error* error, const EnabledStateChangedCallback& callback) { } } -void WiMax::Scan(ScanType /*scan_type*/, Error* error, - const string& /*reason*/) { +void WiMax::Scan(Error* error, const string& /*reason*/) { SLOG(this, 2) << __func__; if (scanning_) { Error::PopulateAndLog( diff --git a/wimax/wimax.h b/wimax/wimax.h index 6f700b62..fc220009 100644 --- a/wimax/wimax.h +++ b/wimax/wimax.h @@ -53,8 +53,7 @@ class WiMax : public Device { void Start(Error* error, const EnabledStateChangedCallback& callback) override; void Stop(Error* error, const EnabledStateChangedCallback& callback) override; - void Scan(ScanType /*scan_type*/, Error* error, - const std::string& /*reason*/) override; + void Scan(Error* error, const std::string& /*reason*/) override; virtual void ConnectTo(const WiMaxServiceRefPtr& service, Error* error); virtual void DisconnectFrom(const ServiceRefPtr& service, Error* error); |