diff --git a/ash/system/chromeos/network/network_state_notifier_unittest.cc b/ash/system/chromeos/network/network_state_notifier_unittest.cc index 56fed05bf0e1..1032bf7041f1 100644 --- a/ash/system/chromeos/network/network_state_notifier_unittest.cc +++ b/ash/system/chromeos/network/network_state_notifier_unittest.cc @@ -71,8 +71,8 @@ class NetworkStateNotifierTest : public AshTestBase { DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); service_test->ClearServices(); const bool add_to_visible = true; - // Create wifi and cellular networks and set to online. - service_test->AddService("wifi1", "wifi1", + // Create a wifi network and set to online. + service_test->AddService("/service/wifi1", "wifi1_guid", "wifi1", shill::kTypeWifi, shill::kStateIdle, add_to_visible); service_test->SetServiceProperty("wifi1", diff --git a/chrome/browser/chromeos/customization_document_unittest.cc b/chrome/browser/chromeos/customization_document_unittest.cc index 36b1bcb35ac9..6f3e63be8a82 100644 --- a/chrome/browser/chromeos/customization_document_unittest.cc +++ b/chrome/browser/chromeos/customization_document_unittest.cc @@ -238,11 +238,13 @@ class ServicesCustomizationDocumentTest : public testing::Test { NetworkPortalDetector::CaptivePortalState online_state; online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; online_state.response_code = 204; - network_portal_detector_.SetDefaultNetworkPathForTesting( - default_network_path, - default_network ? default_network->guid() : ""); - network_portal_detector_.SetDetectionResultsForTesting( - default_network_path, online_state); + std::string guid = + default_network ? default_network->guid() : std::string(); + network_portal_detector_.SetDefaultNetworkForTesting(guid); + if (!guid.empty()) { + network_portal_detector_.SetDetectionResultsForTesting( + guid, online_state); + } TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); ServicesCustomizationDocument::RegisterPrefs(local_state_.registry()); diff --git a/chrome/browser/chromeos/login/managed/managed_user_test_base.cc b/chrome/browser/chromeos/login/managed/managed_user_test_base.cc index 1fe451cda1c9..6995ec986411 100644 --- a/chrome/browser/chromeos/login/managed/managed_user_test_base.cc +++ b/chrome/browser/chromeos/login/managed/managed_user_test_base.cc @@ -51,6 +51,9 @@ namespace chromeos { namespace { const char kCurrentPage[] = "$('managed-user-creation').currentPage_"; + +const char kStubEthernetGuid[] = "eth0"; + } ManagedUsersSyncTestAdapter::ManagedUsersSyncTestAdapter(Profile* profile) @@ -195,11 +198,9 @@ void ManagedUserTestBase::SetUpInProcessBrowserTestFixture() { NetworkPortalDetector::CaptivePortalState online_state; online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; online_state.response_code = 204; - network_portal_detector_->SetDefaultNetworkPathForTesting( - kStubEthernetServicePath, - kStubEthernetServicePath /* guid */); - network_portal_detector_->SetDetectionResultsForTesting( - kStubEthernetServicePath, online_state); + network_portal_detector_->SetDefaultNetworkForTesting(kStubEthernetGuid); + network_portal_detector_->SetDetectionResultsForTesting(kStubEthernetGuid, + online_state); } void ManagedUserTestBase::CleanUpOnMainThread() { diff --git a/chrome/browser/chromeos/login/managed/managed_user_test_base.h b/chrome/browser/chromeos/login/managed/managed_user_test_base.h index b4d6760342db..9e2437f5a468 100644 --- a/chrome/browser/chromeos/login/managed/managed_user_test_base.h +++ b/chrome/browser/chromeos/login/managed/managed_user_test_base.h @@ -20,8 +20,6 @@ namespace chromeos { -const char kStubEthernetServicePath[] = "eth0"; - const char kTestManager[] = "test-manager@gmail.com"; const char kTestOtherUser[] = "test-user@gmail.com"; diff --git a/chrome/browser/chromeos/login/screens/update_screen.cc b/chrome/browser/chromeos/login/screens/update_screen.cc index c17751ead0a0..d1bceeb583f2 100644 --- a/chrome/browser/chromeos/login/screens/update_screen.cc +++ b/chrome/browser/chromeos/login/screens/update_screen.cc @@ -454,8 +454,7 @@ void UpdateScreen::OnActorDestroyed(UpdateScreenActor* actor) { actor_ = NULL; } -void UpdateScreen::OnConnectToNetworkRequested( - const std::string& service_path) { +void UpdateScreen::OnConnectToNetworkRequested() { if (state_ == STATE_ERROR) { LOG(WARNING) << "Hiding error message since AP was reselected"; StartUpdateCheck(); diff --git a/chrome/browser/chromeos/login/screens/update_screen.h b/chrome/browser/chromeos/login/screens/update_screen.h index 3a940ab1cdc5..11de336664ac 100644 --- a/chrome/browser/chromeos/login/screens/update_screen.h +++ b/chrome/browser/chromeos/login/screens/update_screen.h @@ -44,8 +44,7 @@ class UpdateScreen: public UpdateEngineClient::Observer, // UpdateScreenActor::Delegate implementation: virtual void CancelUpdate() OVERRIDE; virtual void OnActorDestroyed(UpdateScreenActor* actor) OVERRIDE; - virtual void OnConnectToNetworkRequested( - const std::string& service_path) OVERRIDE; + virtual void OnConnectToNetworkRequested() OVERRIDE; // Starts network check. Made virtual to simplify mocking. virtual void StartNetworkCheck(); diff --git a/chrome/browser/chromeos/login/screens/update_screen_actor.h b/chrome/browser/chromeos/login/screens/update_screen_actor.h index ec3a52458e14..064e2ce37dac 100644 --- a/chrome/browser/chromeos/login/screens/update_screen_actor.h +++ b/chrome/browser/chromeos/login/screens/update_screen_actor.h @@ -22,11 +22,15 @@ class UpdateScreenActor { class Delegate { public: virtual ~Delegate() {} + // Force cancel update. virtual void CancelUpdate() = 0; + + // Called prior to destroying |actor|. virtual void OnActorDestroyed(UpdateScreenActor* actor) = 0; - virtual void OnConnectToNetworkRequested( - const std::string& service_path) = 0; + + // Called any time a new network connect request occurs. + virtual void OnConnectToNetworkRequested() = 0; }; virtual ~UpdateScreenActor() {} diff --git a/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc index 16d1c43117e4..817b703995f6 100644 --- a/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/screens/update_screen_browsertest.cc @@ -32,8 +32,8 @@ namespace chromeos { namespace { -const char kStubEthernetServicePath[] = "eth0"; -const char kStubWifiServicePath[] = "wlan0"; +const char kStubEthernetGuid[] = "eth0"; +const char kStubWifiGuid[] = "wlan0"; } // namespace @@ -64,9 +64,9 @@ class UpdateScreenTest : public WizardInProcessBrowserTest { NetworkPortalDetector::CaptivePortalState online_state; online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; online_state.response_code = 204; - SetDefaultNetworkPath(kStubEthernetServicePath); - SetDetectionResults(kStubEthernetServicePath, online_state); - SetDetectionResults(kStubWifiServicePath, online_state); + SetDefaultNetwork(kStubEthernetGuid); + SetDetectionResults(kStubEthernetGuid, online_state); + SetDetectionResults(kStubWifiGuid, online_state); } virtual void SetUpOnMainThread() OVERRIDE { @@ -102,19 +102,16 @@ class UpdateScreenTest : public WizardInProcessBrowserTest { WizardInProcessBrowserTest::TearDownInProcessBrowserTestFixture(); } - void SetDefaultNetworkPath(const std::string& service_path) { + void SetDefaultNetwork(const std::string& guid) { DCHECK(network_portal_detector_); - network_portal_detector_->SetDefaultNetworkPathForTesting( - service_path, - service_path /* guid */); + network_portal_detector_->SetDefaultNetworkForTesting(guid); } void SetDetectionResults( - const std::string& service_path, + const std::string& guid, const NetworkPortalDetector::CaptivePortalState& state) { DCHECK(network_portal_detector_); - network_portal_detector_->SetDetectionResultsForTesting(service_path, - state); + network_portal_detector_->SetDetectionResultsForTesting(guid, state); } void NotifyPortalDetectionCompleted() { @@ -248,7 +245,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestTemproraryOfflineNetwork) { NetworkPortalDetector::CaptivePortalState portal_state; portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; portal_state.response_code = 200; - SetDetectionResults(kStubEthernetServicePath, portal_state); + SetDetectionResults(kStubEthernetGuid, portal_state); // Update screen will show error message about portal state because // ethernet is behind captive portal. @@ -268,7 +265,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestTemproraryOfflineNetwork) { NetworkPortalDetector::CaptivePortalState online_state; online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; online_state.response_code = 204; - SetDetectionResults(kStubEthernetServicePath, online_state); + SetDetectionResults(kStubEthernetGuid, online_state); // Second notification from portal detector will be about online state, // so update screen will hide error message and proceed to update. @@ -294,7 +291,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestTwoOfflineNetworks) { NetworkPortalDetector::CaptivePortalState portal_state; portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; portal_state.response_code = 200; - SetDetectionResults(kStubEthernetServicePath, portal_state); + SetDetectionResults(kStubEthernetGuid, portal_state); // Update screen will show error message about portal state because // ethernet is behind captive portal. @@ -316,8 +313,8 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestTwoOfflineNetworks) { proxy_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; proxy_state.response_code = -1; - SetDefaultNetworkPath(kStubWifiServicePath); - SetDetectionResults(kStubWifiServicePath, proxy_state); + SetDefaultNetwork(kStubWifiGuid); + SetDetectionResults(kStubWifiGuid, proxy_state); // Update screen will show message about proxy error because wifie // network requires proxy authentication. @@ -329,7 +326,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestTwoOfflineNetworks) { } IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestVoidNetwork) { - SetDefaultNetworkPath(""); + SetDefaultNetwork(std::string()); // Cancels pending update request. EXPECT_CALL(*mock_screen_observer_, @@ -373,7 +370,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestAPReselection) { NetworkPortalDetector::CaptivePortalState portal_state; portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; portal_state.response_code = 200; - SetDetectionResults(kStubEthernetServicePath, portal_state); + SetDetectionResults(kStubEthernetGuid, portal_state); // Update screen will show error message about portal state because // ethernet is behind captive portal. @@ -401,7 +398,7 @@ IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestAPReselection) { OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE)) .Times(1); - update_screen_->OnConnectToNetworkRequested(kStubEthernetServicePath); + update_screen_->OnConnectToNetworkRequested(); base::MessageLoop::current()->RunUntilIdle(); } diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.cc b/chrome/browser/chromeos/login/test/oobe_base_test.cc index 583a3eb9008a..af8d5b4398fd 100644 --- a/chrome/browser/chromeos/login/test/oobe_base_test.cc +++ b/chrome/browser/chromeos/login/test/oobe_base_test.cc @@ -57,9 +57,8 @@ void OobeBaseTest::SetUpInProcessBrowserTestFixture() { host_resolver()->AddRule("*", "127.0.0.1"); network_portal_detector_ = new NetworkPortalDetectorTestImpl(); NetworkPortalDetector::InitializeForTesting(network_portal_detector_); - network_portal_detector_->SetDefaultNetworkPathForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, - FakeShillManagerClient::kFakeEthernetNetworkPath /* guid */); + network_portal_detector_->SetDefaultNetworkForTesting( + FakeShillManagerClient::kFakeEthernetNetworkGuid); ExtensionApiTest::SetUpInProcessBrowserTestFixture(); } @@ -110,7 +109,8 @@ void OobeBaseTest::SimulateNetworkOffline() { NetworkPortalDetector::CaptivePortalState offline_state; offline_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE; network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, offline_state); + FakeShillManagerClient::kFakeEthernetNetworkGuid, + offline_state); network_portal_detector_->NotifyObserversForTesting(); } @@ -124,7 +124,8 @@ void OobeBaseTest::SimulateNetworkOnline() { online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; online_state.response_code = 204; network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, online_state); + FakeShillManagerClient::kFakeEthernetNetworkGuid, + online_state); network_portal_detector_->NotifyObserversForTesting(); } @@ -137,7 +138,8 @@ void OobeBaseTest::SimulateNetworkPortal() { NetworkPortalDetector::CaptivePortalState portal_state; portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, portal_state); + FakeShillManagerClient::kFakeEthernetNetworkGuid, + portal_state); network_portal_detector_->NotifyObserversForTesting(); } diff --git a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc index 3efd5155e544..ae51062042cc 100644 --- a/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc +++ b/chrome/browser/chromeos/login/ui/captive_portal_window_browsertest.cc @@ -187,11 +187,11 @@ class CaptivePortalWindowCtorDtorTest : public LoginManagerTest { NetworkPortalDetector::CaptivePortalState portal_state; portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; portal_state.response_code = 200; - network_portal_detector_->SetDefaultNetworkPathForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, - FakeShillManagerClient::kFakeEthernetNetworkPath /* guid */); + network_portal_detector_->SetDefaultNetworkForTesting( + FakeShillManagerClient::kFakeEthernetNetworkGuid); network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkPath, portal_state); + FakeShillManagerClient::kFakeEthernetNetworkGuid, + portal_state); } protected: diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index bebe1e6cb4be..cd076d9b7212 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -432,11 +432,10 @@ class WizardControllerFlowTest : public WizardControllerTest { const NetworkState* default_network = NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); - network_portal_detector_->SetDefaultNetworkPathForTesting( - default_network->path(), + network_portal_detector_->SetDefaultNetworkForTesting( default_network->guid()); network_portal_detector_->SetDetectionResultsForTesting( - default_network->path(), + default_network->guid(), online_state); } diff --git a/chrome/browser/chromeos/net/delay_network_call.cc b/chrome/browser/chromeos/net/delay_network_call.cc index d42e5bc68079..044cd2b12d47 100644 --- a/chrome/browser/chromeos/net/delay_network_call.cc +++ b/chrome/browser/chromeos/net/delay_network_call.cc @@ -35,7 +35,7 @@ void chromeos::DelayNetworkCall(const base::Closure& callback, if (!delay_network_call && NetworkPortalDetector::IsInitialized()) { NetworkPortalDetector* detector = NetworkPortalDetector::Get(); NetworkPortalDetector::CaptivePortalStatus status = - detector->GetCaptivePortalState(default_network->path()).status; + detector->GetCaptivePortalState(default_network->guid()).status; if (status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE) { delay_network_call = true; DVLOG(1) << "DelayNetworkCall: Captive portal status for " diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_impl.cc index ff4af46e7559..79edc42950a4 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_impl.cc +++ b/chrome/browser/chromeos/net/network_portal_detector_impl.cc @@ -252,7 +252,7 @@ void NetworkPortalDetectorImpl::AddAndFireObserver(Observer* observer) { CaptivePortalState portal_state; const NetworkState* network = DefaultNetwork(); if (network) - portal_state = GetCaptivePortalState(network->path()); + portal_state = GetCaptivePortalState(network->guid()); observer->OnPortalDetectionCompleted(network, portal_state); } @@ -275,18 +275,20 @@ void NetworkPortalDetectorImpl::Enable(bool start_detection) { const NetworkState* network = DefaultNetwork(); if (!start_detection || !network) return; - portal_state_map_.erase(network->path()); + VLOG(1) << "Starting detection for: " + << "name=" << network->name() << ", id=" << network->guid(); + portal_state_map_.erase(network->guid()); StartDetection(); } NetworkPortalDetectorImpl::CaptivePortalState -NetworkPortalDetectorImpl::GetCaptivePortalState( - const std::string& service_path) { +NetworkPortalDetectorImpl::GetCaptivePortalState(const std::string& guid) { DCHECK(CalledOnValidThread()); - CaptivePortalStateMap::const_iterator it = - portal_state_map_.find(service_path); - if (it == portal_state_map_.end()) + CaptivePortalStateMap::const_iterator it = portal_state_map_.find(guid); + if (it == portal_state_map_.end()) { + VLOG(1) << "CaptivePortalState not found for: " << guid; return CaptivePortalState(); + } return it->second; } @@ -312,8 +314,8 @@ void NetworkPortalDetectorImpl::DefaultNetworkChanged( DCHECK(CalledOnValidThread()); if (!default_network) { + VLOG(1) << "DefaultNetworkChanged: None."; default_network_name_.clear(); - default_network_id_.clear(); StopDetection(); @@ -324,15 +326,21 @@ void NetworkPortalDetectorImpl::DefaultNetworkChanged( } default_network_name_ = default_network->name(); - default_network_id_ = default_network->guid(); - bool network_changed = (default_service_path_ != default_network->path()); - default_service_path_ = default_network->path(); + bool network_changed = (default_network_id_ != default_network->guid()); + default_network_id_ = default_network->guid(); bool connection_state_changed = (default_connection_state_ != default_network->connection_state()); default_connection_state_ = default_network->connection_state(); + VLOG(1) << "DefaultNetworkChanged: " + << "name=" << default_network_name_ << ", " + << "id=" << default_network_id_ << ", " + << "state=" << default_connection_state_ << ", " + << "changed=" << network_changed << ", " + << "state_changed=" << connection_state_changed; + if (network_changed || connection_state_changed) StopDetection(); @@ -341,7 +349,7 @@ void NetworkPortalDetectorImpl::DefaultNetworkChanged( // Initiate Captive Portal detection if network's captive // portal state is unknown (e.g. for freshly created networks), // offline or if network connection state was changed. - CaptivePortalState state = GetCaptivePortalState(default_network->path()); + CaptivePortalState state = GetCaptivePortalState(default_network->guid()); if (state.status == CAPTIVE_PORTAL_STATUS_UNKNOWN || state.status == CAPTIVE_PORTAL_STATUS_OFFLINE || (!network_changed && connection_state_changed)) { @@ -533,7 +541,7 @@ void NetworkPortalDetectorImpl::OnDetectionCompleted( } CaptivePortalStateMap::const_iterator it = - portal_state_map_.find(network->path()); + portal_state_map_.find(network->guid()); if (it == portal_state_map_.end() || it->second.status != state.status || it->second.response_code != state.response_code) { VLOG(1) << "Updating Chrome Captive Portal state: " @@ -552,7 +560,7 @@ void NetworkPortalDetectorImpl::OnDetectionCompleted( RecordPortalToOnlineTransition(state.time - it->second.time); } - portal_state_map_[network->path()] = state; + portal_state_map_[network->guid()] = state; } NotifyDetectionCompleted(network, state); } diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl.h b/chrome/browser/chromeos/net/network_portal_detector_impl.h index 53125534e7bf..f1cac1af30ca 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_impl.h +++ b/chrome/browser/chromeos/net/network_portal_detector_impl.h @@ -72,7 +72,7 @@ class NetworkPortalDetectorImpl virtual void AddAndFireObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual CaptivePortalState GetCaptivePortalState( - const std::string& service_path) OVERRIDE; + const std::string& guid) OVERRIDE; virtual bool IsEnabled() OVERRIDE; virtual void Enable(bool start_detection) OVERRIDE; virtual bool StartDetectionIfIdle() OVERRIDE; @@ -208,9 +208,6 @@ class NetworkPortalDetectorImpl // Unique identifier of the default network. std::string default_network_id_; - // Service path of the default network. - std::string default_service_path_; - // Connection state of the default network. std::string default_connection_state_; diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc index 31534c9bdc91..d9a52ee77350 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc +++ b/chrome/browser/chromeos/net/network_portal_detector_impl_browsertest.cc @@ -39,7 +39,8 @@ const char* kUserActionMetric = NetworkPortalNotificationController::kUserActionMetric; const char kTestUser[] = "test-user@gmail.com"; -const char kWifi[] = "wifi"; +const char kWifiServicePath[] = "/service/wifi"; +const char kWifiGuid[] = "wifi"; void ErrorCallbackFunction(const std::string& error_name, const std::string& error_message) { @@ -105,13 +106,14 @@ class NetworkPortalDetectorImplBrowserTest ShillServiceClient::TestInterface* service_test = DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); service_test->ClearServices(); - service_test->AddService(kWifi, - kWifi, + service_test->AddService(kWifiServicePath, + kWifiGuid, + "wifi", shill::kTypeEthernet, shill::kStateIdle, true /* add_to_visible */); DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( - dbus::ObjectPath(kWifi), + dbus::ObjectPath(kWifiServicePath), shill::kStateProperty, base::StringValue(shill::kStatePortal), base::Bind(&base::DoNothing), @@ -167,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(NetworkPortalDetectorImplBrowserTest, content::RunAllPendingInMessageLoop(); // User connects to wifi. - SetConnected(kWifi); + SetConnected(kWifiServicePath); ASSERT_EQ(PortalDetectorStrategy::STRATEGY_ID_SESSION, strategy()->Id()); @@ -179,8 +181,9 @@ IN_PROC_BROWSER_TEST_F(NetworkPortalDetectorImplBrowserTest, // Check that wifi is marked as behind the portal and that notification // is displayed. ASSERT_TRUE(message_center()->FindVisibleNotificationById(kNotificationId)); - ASSERT_EQ(NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, - NetworkPortalDetector::Get()->GetCaptivePortalState(kWifi).status); + ASSERT_EQ( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, + NetworkPortalDetector::Get()->GetCaptivePortalState(kWifiGuid).status); // Wait until notification is displayed. observer.WaitAndReset(); diff --git a/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc b/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc index 2bf11a33352f..616c1827c35c 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc +++ b/chrome/browser/chromeos/net/network_portal_detector_impl_unittest.cc @@ -40,7 +40,7 @@ namespace chromeos { namespace { -// Service paths for stub network devices. +// Service path / guid for stub networks. const char kStubEthernet[] = "stub_ethernet"; const char kStubWireless1[] = "stub_wifi1"; const char kStubWireless2[] = "stub_wifi2"; @@ -101,9 +101,9 @@ class NetworkPortalDetectorImplTest void CheckPortalState(NetworkPortalDetector::CaptivePortalStatus status, int response_code, - const std::string& service_path) { + const std::string& guid) { NetworkPortalDetector::CaptivePortalState state = - network_portal_detector()->GetCaptivePortalState(service_path); + network_portal_detector()->GetCaptivePortalState(guid); ASSERT_EQ(status, state.status); ASSERT_EQ(response_code, state.response_code); } @@ -232,32 +232,25 @@ class NetworkPortalDetectorImplTest } private: + void AddService(const std::string& network_id, + const std::string& type) { + DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> + AddService(network_id /* service_path */, + network_id /* guid */, + network_id /* name */, + type, + shill::kStateIdle, + true /* add_to_visible */); + } + void SetupDefaultShillState() { base::RunLoop().RunUntilIdle(); - ShillServiceClient::TestInterface* service_test = - DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); - service_test->ClearServices(); - const bool add_to_visible = true; - service_test->AddService(kStubEthernet, - kStubEthernet, - shill::kTypeEthernet, - shill::kStateIdle, - add_to_visible); - service_test->AddService(kStubWireless1, - kStubWireless1, - shill::kTypeWifi, - shill::kStateIdle, - add_to_visible); - service_test->AddService(kStubWireless2, - kStubWireless2, - shill::kTypeWifi, - shill::kStateIdle, - add_to_visible); - service_test->AddService(kStubCellular, - kStubCellular, - shill::kTypeCellular, - shill::kStateIdle, - add_to_visible); + DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface()-> + ClearServices(); + AddService(kStubEthernet, shill::kTypeEthernet); + AddService(kStubWireless1, shill::kTypeWifi); + AddService(kStubWireless2, shill::kTypeWifi); + AddService(kStubCellular, shill::kTypeCellular); } void SetupNetworkHandler() { diff --git a/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc b/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc index 7913514bc240..fafada08c757 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc +++ b/chrome/browser/chromeos/net/network_portal_detector_test_impl.cc @@ -15,35 +15,30 @@ NetworkPortalDetectorTestImpl::NetworkPortalDetectorTestImpl() NetworkPortalDetectorTestImpl::~NetworkPortalDetectorTestImpl() { } -void NetworkPortalDetectorTestImpl::SetDefaultNetworkPathForTesting( - const std::string& service_path, +void NetworkPortalDetectorTestImpl::SetDefaultNetworkForTesting( const std::string& guid) { - DVLOG(1) << "SetDefaultNetworkPathForTesting:" - << " service path: " << service_path - << " guid: " << guid; - if (service_path.empty()) { + DVLOG(1) << "SetDefaultNetworkForTesting: " << guid; + if (guid.empty()) { default_network_.reset(); } else { - default_network_.reset(new NetworkState(service_path)); + default_network_.reset(new NetworkState("/service/" + guid)); default_network_->SetGuid(guid); } } void NetworkPortalDetectorTestImpl::SetDetectionResultsForTesting( - const std::string& service_path, + const std::string& guid, const CaptivePortalState& state) { - DVLOG(1) << "SetDetectionResultsForTesting: " << service_path << " = " + DVLOG(1) << "SetDetectionResultsForTesting: " << guid << " = " << NetworkPortalDetector::CaptivePortalStatusString(state.status); - if (!service_path.empty()) - portal_state_map_[service_path] = state; + if (!guid.empty()) + portal_state_map_[guid] = state; } void NetworkPortalDetectorTestImpl::NotifyObserversForTesting() { CaptivePortalState state; - if (default_network_ && - portal_state_map_.count(default_network_->path())) { - state = portal_state_map_[default_network_->path()]; - } + if (default_network_ && portal_state_map_.count(default_network_->guid())) + state = portal_state_map_[default_network_->guid()]; FOR_EACH_OBSERVER(Observer, observers_, OnPortalDetectionCompleted(default_network_.get(), state)); } @@ -57,14 +52,12 @@ void NetworkPortalDetectorTestImpl::AddAndFireObserver(Observer* observer) { AddObserver(observer); if (!observer) return; - if (!default_network_ || - !portal_state_map_.count(default_network_->path())) { + if (!default_network_ || !portal_state_map_.count(default_network_->guid())) { observer->OnPortalDetectionCompleted(default_network_.get(), CaptivePortalState()); } else { observer->OnPortalDetectionCompleted( - default_network_.get(), - portal_state_map_[default_network_->path()]); + default_network_.get(), portal_state_map_[default_network_->guid()]); } } @@ -75,13 +68,13 @@ void NetworkPortalDetectorTestImpl::RemoveObserver(Observer* observer) { NetworkPortalDetector::CaptivePortalState NetworkPortalDetectorTestImpl::GetCaptivePortalState( - const std::string& service_path) { - CaptivePortalStateMap::iterator it = portal_state_map_.find(service_path); + const std::string& guid) { + CaptivePortalStateMap::iterator it = portal_state_map_.find(guid); if (it == portal_state_map_.end()) { - DVLOG(2) << "GetCaptivePortalState Not found: " << service_path; + DVLOG(2) << "GetCaptivePortalState Not found: " << guid; return CaptivePortalState(); } - DVLOG(2) << "GetCaptivePortalState: " << service_path << " = " + DVLOG(2) << "GetCaptivePortalState: " << guid << " = " << CaptivePortalStatusString(it->second.status); return it->second; } diff --git a/chrome/browser/chromeos/net/network_portal_detector_test_impl.h b/chrome/browser/chromeos/net/network_portal_detector_test_impl.h index f91690700e85..9924ffc57fe3 100644 --- a/chrome/browser/chromeos/net/network_portal_detector_test_impl.h +++ b/chrome/browser/chromeos/net/network_portal_detector_test_impl.h @@ -21,9 +21,8 @@ class NetworkPortalDetectorTestImpl : public NetworkPortalDetector { NetworkPortalDetectorTestImpl(); virtual ~NetworkPortalDetectorTestImpl(); - void SetDefaultNetworkPathForTesting(const std::string& service_path, - const std::string& guid); - void SetDetectionResultsForTesting(const std::string& service_path, + void SetDefaultNetworkForTesting(const std::string& guid); + void SetDetectionResultsForTesting(const std::string& guid, const CaptivePortalState& state); void NotifyObserversForTesting(); diff --git a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc index 6f2b81a7dbc0..478e1feb6366 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl_unittest.cc @@ -249,13 +249,12 @@ class ProxyConfigServiceImplTest : public testing::Test { // Sends a notification about the added profile. profile_test->AddProfile(kUserProfilePath, "user_hash"); - service_test->AddService("stub_wifi2", "wifi2_PSK", + service_test->AddService("/service/stub_wifi2", + "stub_wifi2" /* guid */, + "wifi2_PSK", shill::kTypeWifi, shill::kStateOnline, true /* visible */); - service_test->SetServiceProperty("stub_wifi2", - shill::kGuidProperty, - base::StringValue("stub_wifi2")); - profile_test->AddService(kUserProfilePath, "stub_wifi2"); + profile_test->AddService(kUserProfilePath, "/service/stub_wifi2"); loop_.RunUntilIdle(); } diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc index 8f4c81a106b8..d479cdc44c9f 100644 --- a/chrome/browser/chromeos/status/network_menu.cc +++ b/chrome/browser/chromeos/status/network_menu.cc @@ -308,12 +308,10 @@ void NetworkMenuModel::ActivatedAt(int index) { } else if (flags & FLAG_TOGGLE_MOBILE) { ToggleTechnology(NetworkTypePattern::Mobile()); } else if (flags & FLAG_ETHERNET) { - owner_->delegate()->OnConnectToNetworkRequested( - menu_items_[index].service_path); + owner_->delegate()->OnConnectToNetworkRequested(); } else if (flags & (FLAG_WIFI | FLAG_WIMAX | FLAG_CELLULAR)) { ConnectToNetworkAt(index); - owner_->delegate()->OnConnectToNetworkRequested( - menu_items_[index].service_path); + owner_->delegate()->OnConnectToNetworkRequested(); } else if (flags & FLAG_ADD_WIFI) { ShowOther(shill::kTypeWifi); } else if (flags & FLAG_ADD_CELLULAR) { diff --git a/chrome/browser/chromeos/status/network_menu.h b/chrome/browser/chromeos/status/network_menu.h index 99897820976a..76cd637a9cb8 100644 --- a/chrome/browser/chromeos/status/network_menu.h +++ b/chrome/browser/chromeos/status/network_menu.h @@ -67,8 +67,7 @@ class NetworkMenu { virtual gfx::NativeWindow GetNativeWindow() const = 0; virtual void OpenButtonOptions() = 0; virtual bool ShouldOpenButtonOptions() const = 0; - virtual void OnConnectToNetworkRequested( - const std::string& service_path) = 0; + virtual void OnConnectToNetworkRequested() = 0; }; explicit NetworkMenu(Delegate* delegate); diff --git a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc index 779cfe35d839..1908142da221 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_api_chromeos.cc @@ -721,9 +721,6 @@ bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { scoped_ptr params = api::GetCaptivePortalStatus::Params::Create(*args_); EXTENSION_FUNCTION_VALIDATE(params); - std::string service_path; - if (!GetServicePathFromGuid(params->network_guid, &service_path, &error_)) - return false; NetworkPortalDetector* detector = NetworkPortalDetector::Get(); if (!detector) { @@ -732,7 +729,7 @@ bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() { } NetworkPortalDetector::CaptivePortalState state = - detector->GetCaptivePortalState(service_path); + detector->GetCaptivePortalState(params->network_guid); SetResult(new base::StringValue( NetworkPortalDetector::CaptivePortalStatusString(state.status))); diff --git a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc index f9b83065b437..4fe39e950972 100644 --- a/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc +++ b/chrome/browser/extensions/api/networking_private/networking_private_apitest.cc @@ -233,12 +233,9 @@ class ExtensionNetworkingPrivateApiTest const std::string& name, const std::string& type, const std::string& state) { - const bool add_to_visible = true; - // Tests need a known GUID, so use 'service_path'. - service_test_->AddServiceWithIPConfig( - service_path, service_path + "_GUID" /* guid */, name, - type, state, "" /* ipconfig_path */, - add_to_visible); + service_test_->AddService( + service_path, service_path + "_guid", name, + type, state, true /* add_to_visible */); } virtual void SetUpOnMainThread() OVERRIDE { @@ -323,9 +320,6 @@ class ExtensionNetworkingPrivateApiTest base::FundamentalValue(2400)); AddService("stub_wifi2", "wifi2_PSK", shill::kTypeWifi, shill::kStateIdle); - service_test_->SetServiceProperty("stub_wifi2", - shill::kGuidProperty, - base::StringValue("stub_wifi2_GUID")); service_test_->SetServiceProperty("stub_wifi2", shill::kSecurityProperty, base::StringValue(shill::kSecurityPsk)); @@ -592,27 +586,27 @@ IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, NetworkPortalDetector::CaptivePortalState state; state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; - detector()->SetDetectionResultsForTesting("stub_ethernet", state); + detector()->SetDetectionResultsForTesting("stub_ethernet_guid", state); state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE; - detector()->SetDetectionResultsForTesting("stub_wifi1", state); + detector()->SetDetectionResultsForTesting("stub_wifi1_guid", state); state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; - detector()->SetDetectionResultsForTesting("stub_wifi2", state); + detector()->SetDetectionResultsForTesting("stub_wifi2_guid", state); state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PROXY_AUTH_REQUIRED; - detector()->SetDetectionResultsForTesting("stub_cellular1", state); + detector()->SetDetectionResultsForTesting("stub_cellular1_guid", state); EXPECT_TRUE(RunNetworkingSubtest("getCaptivePortalStatus")) << message_; } IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, CaptivePortalNotification) { - detector()->SetDefaultNetworkPathForTesting("wifi", "wifi_GUID"); + detector()->SetDefaultNetworkForTesting("wifi_guid"); NetworkPortalDetector::CaptivePortalState state; state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; - detector()->SetDetectionResultsForTesting("wifi", state); + detector()->SetDetectionResultsForTesting("wifi_guid", state); TestListener listener( "notifyPortalDetectorObservers", diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc index 15e51283c710..4cb9a4ade11b 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.cc @@ -151,9 +151,8 @@ bool NetworkDropdown::ShouldOpenButtonOptions() const { return !oobe_; } -void NetworkDropdown::OnConnectToNetworkRequested( - const std::string& service_path) { - actor_->OnConnectToNetworkRequested(service_path); +void NetworkDropdown::OnConnectToNetworkRequested() { + actor_->OnConnectToNetworkRequested(); } void NetworkDropdown::DefaultNetworkChanged(const NetworkState* network) { diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h index f7d798fe30e4..02df8059a9fc 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown.h @@ -29,8 +29,7 @@ class NetworkDropdown : public NetworkMenu::Delegate, class Actor { public: virtual ~Actor() {} - virtual void OnConnectToNetworkRequested( - const std::string& service_path) = 0; + virtual void OnConnectToNetworkRequested() = 0; }; NetworkDropdown(Actor* actor, content::WebUI* web_ui, bool oobe); @@ -43,8 +42,7 @@ class NetworkDropdown : public NetworkMenu::Delegate, virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; virtual void OpenButtonOptions() OVERRIDE; virtual bool ShouldOpenButtonOptions() const OVERRIDE; - virtual void OnConnectToNetworkRequested( - const std::string& service_path) OVERRIDE; + virtual void OnConnectToNetworkRequested() OVERRIDE; // NetworkStateHandlerObserver virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE; diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc index d32260fdae64..ee57b5fc57a4 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.cc @@ -58,10 +58,8 @@ void NetworkDropdownHandler::RegisterMessages() { &NetworkDropdownHandler::HandleNetworkDropdownRefresh); } -void NetworkDropdownHandler::OnConnectToNetworkRequested( - const std::string& service_path) { - FOR_EACH_OBSERVER(Observer, observers_, - OnConnectToNetworkRequested(service_path)); +void NetworkDropdownHandler::OnConnectToNetworkRequested() { + FOR_EACH_OBSERVER(Observer, observers_, OnConnectToNetworkRequested()); } void NetworkDropdownHandler::HandleNetworkItemChosen(double id) { diff --git a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h index beaea8e924a5..2bdc6bd5e6ac 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h @@ -20,8 +20,7 @@ class NetworkDropdownHandler : public BaseScreenHandler, class Observer { public: virtual ~Observer() {} - virtual void OnConnectToNetworkRequested( - const std::string& service_path) = 0; + virtual void OnConnectToNetworkRequested() = 0; }; NetworkDropdownHandler(); @@ -39,8 +38,7 @@ class NetworkDropdownHandler : public BaseScreenHandler, private: // NetworkDropdown::Actor implementation: - virtual void OnConnectToNetworkRequested( - const std::string& service_path) OVERRIDE; + virtual void OnConnectToNetworkRequested() OVERRIDE; // Handles choosing of the network menu item. void HandleNetworkItemChosen(double id); diff --git a/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc b/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc index a1bc27eaa4ad..ad93d441b8fe 100644 --- a/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc +++ b/chrome/browser/ui/webui/chromeos/login/network_state_informer.cc @@ -49,7 +49,7 @@ NetworkStateInformer::State GetStateForDefaultNetwork() { if (NetworkPortalDetector::Get()->IsEnabled()) { NetworkPortalDetector::CaptivePortalState state = - NetworkPortalDetector::Get()->GetCaptivePortalState(network->path()); + NetworkPortalDetector::Get()->GetCaptivePortalState(network->guid()); NetworkPortalDetector::CaptivePortalStatus status = state.status; if (status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN && NetworkState::StateIsConnecting(network->connection_state())) { diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc index 0b8824eff355..3eea8eeb47fa 100644 --- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc @@ -136,10 +136,9 @@ void UpdateScreenHandler::RegisterMessages() { #endif } -void UpdateScreenHandler::OnConnectToNetworkRequested( - const std::string& service_path) { +void UpdateScreenHandler::OnConnectToNetworkRequested() { if (screen_) - screen_->OnConnectToNetworkRequested(service_path); + screen_->OnConnectToNetworkRequested(); } #if !defined(OFFICIAL_BUILD) diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h index bc7823edaf6d..d7c08cc29811 100644 --- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.h @@ -43,8 +43,7 @@ class UpdateScreenHandler : public UpdateScreenActor, private: // NetworkDropdownHandler::Observer implementation: - virtual void OnConnectToNetworkRequested( - const std::string& service_path) OVERRIDE; + virtual void OnConnectToNetworkRequested() OVERRIDE; #if !defined(OFFICIAL_BUILD) // Called when user presses Escape to cancel update. diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index 77a35fe12a75..f5bcdf9f8168 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -848,13 +848,11 @@ class ProxyPreferencesBrowserTest : public PreferencesBrowserTest { service_test->ClearServices(); service_test->AddService("stub_ethernet", + "stub_ethernet_guid", "eth0", shill::kTypeEthernet, shill::kStateOnline, true /* add_to_visible */ ); - service_test->SetServiceProperty("stub_ethernet", - shill::kGuidProperty, - base::StringValue("stub_ethernet")); service_test->SetServiceProperty("stub_ethernet", shill::kProfileProperty, base::StringValue(kUserProfilePath)); @@ -864,7 +862,7 @@ class ProxyPreferencesBrowserTest : public PreferencesBrowserTest { void SetONCPolicy(const char* policy_name, policy::PolicyScope scope) { std::string onc_policy = "{ \"NetworkConfigurations\": [" - " { \"GUID\": \"stub_ethernet\"," + " { \"GUID\": \"stub_ethernet_guid\"," " \"Type\": \"Ethernet\"," " \"Name\": \"My Ethernet\"," " \"Ethernet\": {" diff --git a/chrome/test/data/extensions/api_test/networking/test.js b/chrome/test/data/extensions/api_test/networking/test.js index 28a7de1a9347..a9c94663e975 100644 --- a/chrome/test/data/extensions/api_test/networking/test.js +++ b/chrome/test/data/extensions/api_test/networking/test.js @@ -74,13 +74,13 @@ var privateHelpers = { var availableTests = [ function startConnect() { - chrome.networkingPrivate.startConnect("stub_wifi2_GUID", callbackPass()); + chrome.networkingPrivate.startConnect("stub_wifi2_guid", callbackPass()); }, function startDisconnect() { // Must connect to a network before we can disconnect from it. - chrome.networkingPrivate.startConnect("stub_wifi2_GUID", callbackPass( + chrome.networkingPrivate.startConnect("stub_wifi2_guid", callbackPass( function() { - chrome.networkingPrivate.startDisconnect("stub_wifi2_GUID", + chrome.networkingPrivate.startDisconnect("stub_wifi2_guid", callbackPass()); })); }, @@ -130,7 +130,7 @@ var availableTests = [ assertEq([{ "Connectable": true, "ConnectionState": "Connected", - "GUID": "stub_wifi1_GUID", + "GUID": "stub_wifi1_guid", "Name": "wifi1", "Type": "WiFi", "WiFi": { @@ -138,7 +138,7 @@ var availableTests = [ "SignalStrength": 40 } }, { - "GUID": "stub_wifi2_GUID", + "GUID": "stub_wifi2_guid", "Name": "wifi2_PSK", "Type": "WiFi", "WiFi": { @@ -153,7 +153,7 @@ var availableTests = [ assertEq([{ "Connectable": true, "ConnectionState": "Connected", - "GUID": "stub_wifi1_GUID", + "GUID": "stub_wifi1_guid", "Name": "wifi1", "Type": "WiFi", "WiFi": { @@ -171,7 +171,7 @@ var availableTests = [ "Ethernet": { "Authentication": "None" }, - "GUID": "stub_ethernet_GUID", + "GUID": "stub_ethernet_guid", "Name": "eth0", "Type": "Ethernet" }], result); @@ -188,14 +188,14 @@ var availableTests = [ "Ethernet": { "Authentication": "None" }, - "GUID": "stub_ethernet_GUID", + "GUID": "stub_ethernet_guid", "Name": "eth0", "Type": "Ethernet" }, { "Connectable": true, "ConnectionState": "Connected", - "GUID": "stub_wifi1_GUID", + "GUID": "stub_wifi1_guid", "Name": "wifi1", "Type": "WiFi", "WiFi": { @@ -205,14 +205,14 @@ var availableTests = [ }, { "ConnectionState": "Connected", - "GUID": "stub_vpn1_GUID", + "GUID": "stub_vpn1_guid", "Name": "vpn1", "Type": "VPN" }, { "Connectable": true, "ConnectionState": "NotConnected", - "GUID": "stub_wifi2_GUID", + "GUID": "stub_wifi2_guid", "Name": "wifi2_PSK", "Type": "WiFi", "WiFi": { @@ -229,7 +229,7 @@ var availableTests = [ assertEq([{ "Connectable": true, "ConnectionState": "Connected", - "GUID": "stub_wifi1_GUID", + "GUID": "stub_wifi1_guid", "Name": "wifi1", "Type": "WiFi", "WiFi": { @@ -240,7 +240,7 @@ var availableTests = [ { "Connectable": true, "ConnectionState": "NotConnected", - "GUID": "stub_wifi2_GUID", + "GUID": "stub_wifi2_guid", "Name": "wifi2_PSK", "Type": "WiFi", "WiFi": { @@ -253,10 +253,10 @@ var availableTests = [ }, function requestNetworkScan() { // Connected or Connecting networks should be listed first, sorted by type. - var expected = ["stub_ethernet_GUID", - "stub_wifi1_GUID", - "stub_vpn1_GUID", - "stub_wifi2_GUID"]; + var expected = ["stub_ethernet_guid", + "stub_wifi1_guid", + "stub_vpn1_guid", + "stub_wifi2_guid"]; var done = chrome.test.callbackAdded(); var listener = new privateHelpers.listListener(expected, done); chrome.networkingPrivate.onNetworkListChanged.addListener( @@ -265,11 +265,11 @@ var availableTests = [ }, function getProperties() { chrome.networkingPrivate.getProperties( - "stub_wifi1_GUID", + "stub_wifi1_guid", callbackPass(function(result) { assertEq({ "Connectable": true, "ConnectionState": "Connected", - "GUID": "stub_wifi1_GUID", + "GUID": "stub_wifi1_guid", "MacAddress": "00:11:22:AA:BB:CC", "IPConfigs": [{ "Gateway": "0.0.0.1", @@ -291,7 +291,7 @@ var availableTests = [ }, function getPropertiesCellular() { chrome.networkingPrivate.getProperties( - "stub_cellular1_GUID", + "stub_cellular1_guid", callbackPass(function(result) { assertEq({ "Cellular": { "ActivationState": "not-activated", @@ -305,7 +305,7 @@ var availableTests = [ "RoamingState": "home" }, "ConnectionState": "NotConnected", - "GUID": "stub_cellular1_GUID", + "GUID": "stub_cellular1_guid", "Name": "cellular1", "Type": "Cellular" }, result); @@ -373,7 +373,7 @@ var availableTests = [ }, function setProperties() { var done = chrome.test.callbackAdded(); - var network_guid = "stub_wifi2_GUID"; + var network_guid = "stub_wifi2_guid"; chrome.networkingPrivate.getProperties( network_guid, callbackPass(function(result) { @@ -397,12 +397,12 @@ var availableTests = [ }, function getState() { chrome.networkingPrivate.getState( - "stub_wifi2_GUID", + "stub_wifi2_guid", callbackPass(function(result) { assertEq({ "Connectable": true, "ConnectionState": "NotConnected", - "GUID": "stub_wifi2_GUID", + "GUID": "stub_wifi2_guid", "Name": "wifi2_PSK", "Type": "WiFi", "WiFi": { @@ -418,7 +418,7 @@ var availableTests = [ callbackFail('Error.InvalidNetworkGuid')); }, function onNetworksChangedEventConnect() { - var network = "stub_wifi2_GUID"; + var network = "stub_wifi2_guid"; var done = chrome.test.callbackAdded(); var expectedStates = ["Connected"]; var listener = @@ -426,7 +426,7 @@ var availableTests = [ chrome.networkingPrivate.startConnect(network, callbackPass()); }, function onNetworksChangedEventDisconnect() { - var network = "stub_wifi1_GUID"; + var network = "stub_wifi1_guid"; var done = chrome.test.callbackAdded(); var expectedStates = ["NotConnected"]; var listener = @@ -436,15 +436,15 @@ var availableTests = [ function onNetworkListChangedEvent() { // Connecting to wifi2 should set wifi1 to offline. Connected or Connecting // networks should be listed first, sorted by type. - var expected = ["stub_ethernet_GUID", - "stub_wifi2_GUID", - "stub_vpn1_GUID", - "stub_wifi1_GUID"]; + var expected = ["stub_ethernet_guid", + "stub_wifi2_guid", + "stub_vpn1_guid", + "stub_wifi1_guid"]; var done = chrome.test.callbackAdded(); var listener = new privateHelpers.listListener(expected, done); chrome.networkingPrivate.onNetworkListChanged.addListener( listener.listenForChanges); - var network = "stub_wifi2_GUID"; + var network = "stub_wifi2_guid"; chrome.networkingPrivate.startConnect(network, callbackPass()); }, function verifyDestination() { @@ -455,7 +455,7 @@ var availableTests = [ })); }, function verifyAndEncryptCredentials() { - var network_guid = "stub_wifi2_GUID"; + var network_guid = "stub_wifi2_guid"; chrome.networkingPrivate.verifyAndEncryptCredentials( verificationProperties, network_guid, @@ -487,16 +487,16 @@ var availableTests = [ })); }, function getCaptivePortalStatus() { - var networks = [['stub_ethernet_GUID', 'Online'], - ['stub_wifi1_GUID', 'Offline'], - ['stub_wifi2_GUID', 'Portal'], - ['stub_cellular1_GUID', 'ProxyAuthRequired'], - ['stub_vpn1_GUID', 'Unknown']]; + var networks = [['stub_ethernet_guid', 'Online'], + ['stub_wifi1_guid', 'Offline'], + ['stub_wifi2_guid', 'Portal'], + ['stub_cellular1_guid', 'ProxyAuthRequired'], + ['stub_vpn1_guid', 'Unknown']]; networks.forEach(function(network) { - var servicePath = network[0]; + var guid = network[0]; var expectedStatus = network[1]; chrome.networkingPrivate.getCaptivePortalStatus( - servicePath, + guid, callbackPass(function(status) { assertEq(expectedStatus, status); })); @@ -506,7 +506,7 @@ var availableTests = [ var done = chrome.test.callbackAdded(); var listener = new privateHelpers.watchForCaptivePortalState( - 'wifi_GUID', 'Online', done); + 'wifi_guid', 'Online', done); chrome.test.sendMessage('notifyPortalDetectorObservers'); }, ]; diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc index 226a77836e1e..71d2dc0e26f1 100644 --- a/chromeos/dbus/fake_shill_manager_client.cc +++ b/chromeos/dbus/fake_shill_manager_client.cc @@ -109,7 +109,7 @@ const char* kNetworkDisabled = "disabled"; } // namespace // static -const char FakeShillManagerClient::kFakeEthernetNetworkPath[] = "/service/eth1"; +const char FakeShillManagerClient::kFakeEthernetNetworkGuid[] = "eth1_guid"; FakeShillManagerClient::FakeShillManagerClient() : interactive_delay_(0), @@ -267,7 +267,8 @@ void FakeShillManagerClient::ConfigureService( guid /* guid */, guid /* name */, type, - shill::kStateIdle, ipconfig_path, + shill::kStateIdle, + ipconfig_path, true /* visible */); existing_properties = service_client->GetServiceProperties(service_path); } @@ -617,7 +618,10 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { devices->SetDeviceProperty("/device/eth1", shill::kIPConfigsProperty, eth_ip_configs); - services->AddService(kFakeEthernetNetworkPath, "eth1", + const std::string kFakeEthernetNetworkPath = "/service/eth1"; + services->AddService(kFakeEthernetNetworkPath, + kFakeEthernetNetworkGuid, + "eth1" /* name */, shill::kTypeEthernet, state, add_to_visible); @@ -646,7 +650,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { const std::string kWifi1Path = "/service/wifi1"; services->AddService(kWifi1Path, - "wifi1", + "wifi1_guid", + "wifi1" /* name */, shill::kTypeWifi, state, add_to_visible); @@ -660,7 +665,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { const std::string kWifi2Path = "/service/wifi2"; services->AddService(kWifi2Path, - "wifi2_PSK", + "wifi2_PSK_guid", + "wifi2_PSK" /* name */, shill::kTypeWifi, shill::kStateIdle, add_to_visible); @@ -676,7 +682,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { if (portaled) { const std::string kPortaledWifiPath = "/service/portaled_wifi"; services->AddService(kPortaledWifiPath, - "Portaled Wifi", + "portaled_wifi_guid", + "Portaled Wifi" /* name */, shill::kTypeWifi, shill::kStatePortal, add_to_visible); @@ -701,7 +708,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { "/device/wimax1", shill::kTypeWimax, "stub_wimax_device1"); services->AddService("/service/wimax1", - "wimax1", + "wimax1_guid", + "wimax1" /* name */, shill::kTypeWimax, state, add_to_visible); @@ -726,7 +734,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { base::StringValue(shill::kCarrierSprint)); services->AddService("/service/cellular1", - "cellular1", + "cellular1_guid", + "cellular1" /* name */, shill::kTypeCellular, state, add_to_visible); @@ -768,7 +777,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { provider_properties.SetString(shill::kHostProperty, "vpn_host"); services->AddService("/service/vpn1", - "vpn1", + "vpn1_guid", + "vpn1" /* name */, shill::kTypeVPN, state, add_to_visible); @@ -777,7 +787,8 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { profiles->AddService(shared_profile, "/service/vpn1"); services->AddService("/service/vpn2", - "vpn2", + "vpn2_guid", + "vpn2" /* name */, shill::kTypeVPN, shill::kStateIdle, add_to_visible); diff --git a/chromeos/dbus/fake_shill_manager_client.h b/chromeos/dbus/fake_shill_manager_client.h index c3bd618bb548..4a9419988466 100644 --- a/chromeos/dbus/fake_shill_manager_client.h +++ b/chromeos/dbus/fake_shill_manager_client.h @@ -106,7 +106,7 @@ class CHROMEOS_EXPORT FakeShillManagerClient const std::string& service_path) OVERRIDE; // Constants used for testing. - static const char kFakeEthernetNetworkPath[]; + static const char kFakeEthernetNetworkGuid[]; private: void SetDefaultProperties(); diff --git a/chromeos/dbus/fake_shill_service_client.cc b/chromeos/dbus/fake_shill_service_client.cc index 605f372c159a..9f4bbc385d8c 100644 --- a/chromeos/dbus/fake_shill_service_client.cc +++ b/chromeos/dbus/fake_shill_service_client.cc @@ -305,11 +305,12 @@ ShillServiceClient::TestInterface* FakeShillServiceClient::GetTestInterface() { // ShillServiceClient::TestInterface overrides. void FakeShillServiceClient::AddService(const std::string& service_path, + const std::string& guid, const std::string& name, const std::string& type, const std::string& state, bool visible) { - AddServiceWithIPConfig(service_path, "" /* guid */, name, + AddServiceWithIPConfig(service_path, guid, name, type, state, "" /* ipconfig_path */, visible); } @@ -602,6 +603,7 @@ void FakeShillServiceClient::ContinueConnect( if (ContainsKey(connect_behavior_, service_path)) { const base::Closure& custom_connect_behavior = connect_behavior_[service_path]; + VLOG(1) << "Running custom connect behavior for " << service_path; custom_connect_behavior.Run(); return; } @@ -625,6 +627,7 @@ void FakeShillServiceClient::ContinueConnect( base::StringValue(shill::kErrorBadPassphrase))); } else { // Set Online. + VLOG(1) << "Setting state to Online " << service_path; SetServiceProperty(service_path, shill::kStateProperty, base::StringValue(shill::kStateOnline)); diff --git a/chromeos/dbus/fake_shill_service_client.h b/chromeos/dbus/fake_shill_service_client.h index dfacec7eb242..b2692a41b28d 100644 --- a/chromeos/dbus/fake_shill_service_client.h +++ b/chromeos/dbus/fake_shill_service_client.h @@ -77,6 +77,7 @@ class CHROMEOS_EXPORT FakeShillServiceClient // ShillServiceClient::TestInterface overrides. virtual void AddService(const std::string& service_path, + const std::string& guid, const std::string& name, const std::string& type, const std::string& state, diff --git a/chromeos/dbus/shill_service_client.h b/chromeos/dbus/shill_service_client.h index e8b950fd5fc6..a2e8950dfb1f 100644 --- a/chromeos/dbus/shill_service_client.h +++ b/chromeos/dbus/shill_service_client.h @@ -45,6 +45,7 @@ class CHROMEOS_EXPORT ShillServiceClient : public DBusClient { public: // Adds a Service to the Manager and Service stubs. virtual void AddService(const std::string& service_path, + const std::string& guid, const std::string& name, const std::string& type, const std::string& state, diff --git a/chromeos/network/network_cert_migrator_unittest.cc b/chromeos/network/network_cert_migrator_unittest.cc index 0dcc68df7a20..1482ec36c59b 100644 --- a/chromeos/network/network_cert_migrator_unittest.cc +++ b/chromeos/network/network_cert_migrator_unittest.cc @@ -104,13 +104,19 @@ class NetworkCertMigratorTest : public testing::Test { network_cert_migrator_->Init(network_state_handler_.get()); } + void AddService(const std::string& network_id, + const std::string& type, + const std::string& state) { + service_test_->AddService(network_id /* service_path */, + network_id /* guid */, + network_id /* name */, + type, + state, + true /* add_to_visible */); + } + void SetupWifiWithNss() { - const bool add_to_visible = true; - service_test_->AddService(kWifiStub, - kWifiStub, - shill::kTypeWifi, - shill::kStateOnline, - add_to_visible); + AddService(kWifiStub, shill::kTypeWifi, shill::kStateOnline); service_test_->SetServiceProperty(kWifiStub, shill::kEapCaCertNssProperty, base::StringValue(kNSSNickname)); @@ -131,12 +137,7 @@ class NetworkCertMigratorTest : public testing::Test { } void SetupVpnWithNss(bool open_vpn) { - const bool add_to_visible = true; - service_test_->AddService(kVPNStub, - kVPNStub, - shill::kTypeVPN, - shill::kStateIdle, - add_to_visible); + AddService(kVPNStub, shill::kTypeVPN, shill::kStateIdle); base::DictionaryValue provider; const char* nss_property = open_vpn ? shill::kOpenVPNCaCertNSSProperty : shill::kL2tpIpsecCaCertNssProperty; diff --git a/chromeos/network/network_state_handler_unittest.cc b/chromeos/network/network_state_handler_unittest.cc index c0e3ab7206f1..619a284f6294 100644 --- a/chromeos/network/network_state_handler_unittest.cc +++ b/chromeos/network/network_state_handler_unittest.cc @@ -176,10 +176,11 @@ class NetworkStateHandlerTest : public testing::Test { protected: void AddService(const std::string& service_path, + const std::string& guid, const std::string& name, const std::string& type, const std::string& state) { - service_test_->AddService(service_path, name, type, state, + service_test_->AddService(service_path, guid, name, type, state, true /* add_to_visible */); } @@ -209,18 +210,22 @@ class NetworkStateHandlerTest : public testing::Test { ASSERT_TRUE(service_test_); service_test_->ClearServices(); AddService(kShillManagerClientStubDefaultService, + "eth1_guid", "eth1", shill::kTypeEthernet, shill::kStateOnline); AddService(kShillManagerClientStubDefaultWifi, + "wifi1_guid", "wifi1", shill::kTypeWifi, shill::kStateOnline); AddService(kShillManagerClientStubWifi2, + "wifi2_guid", "wifi2", shill::kTypeWifi, shill::kStateIdle); AddService(kShillManagerClientStubCellular, + "cellular1_guid", "cellular1", shill::kTypeCellular, shill::kStateIdle); @@ -281,8 +286,11 @@ TEST_F(NetworkStateHandlerTest, GetNetworkList) { // Add a non-visible network to the profile. const std::string profile = "/profile/profile1"; const std::string wifi_favorite_path = "/service/wifi_faviorite"; - service_test_->AddService(wifi_favorite_path, "wifi_faviorite", - shill::kTypeWifi, shill::kStateIdle, + service_test_->AddService(wifi_favorite_path, + "wifi_faviorite_guid", + "wifi_faviorite", + shill::kTypeWifi, + shill::kStateIdle, false /* add_to_visible */); profile_test_->AddProfile(profile, "" /* userhash */); EXPECT_TRUE(profile_test_->AddService(profile, wifi_favorite_path)); @@ -362,8 +370,11 @@ TEST_F(NetworkStateHandlerTest, GetVisibleNetworks) { // Add a non-visible network to the profile. const std::string profile = "/profile/profile1"; const std::string wifi_favorite_path = "/service/wifi_faviorite"; - service_test_->AddService(wifi_favorite_path, "wifi_faviorite", - shill::kTypeWifi, shill::kStateIdle, + service_test_->AddService(wifi_favorite_path, + "wifi_faviorite_guid", + "wifi_faviorite", + shill::kTypeWifi, + shill::kStateIdle, false /* add_to_visible */); message_loop_.RunUntilIdle(); EXPECT_EQ(kNumShillManagerClientStubImplServices + 1, @@ -634,18 +645,13 @@ TEST_F(NetworkStateHandlerTest, RequestUpdate) { TEST_F(NetworkStateHandlerTest, NetworkGuidInProfile) { const std::string profile = "/profile/profile1"; const std::string wifi_path = "/service/wifi_with_guid"; - const std::string wifi_guid = "WIFI_GUID"; + const std::string wifi_guid = "wifi_guid"; + const std::string wifi_name = "WifiWithGuid"; const bool is_service_configured = true; // Add a network to the default Profile with a specified GUID. - service_test_->AddServiceWithIPConfig( - wifi_path, - wifi_guid, - wifi_path /* name */, - shill::kTypeWifi, - shill::kStateOnline, - "" /* ipconfig_path */, - true /* add_to_visible */); + AddService(wifi_path, wifi_guid, wifi_name, + shill::kTypeWifi, shill::kStateOnline); profile_test_->AddProfile(profile, "" /* userhash */); EXPECT_TRUE(profile_test_->AddService(profile, wifi_path)); UpdateManagerProperties(); @@ -664,7 +670,8 @@ TEST_F(NetworkStateHandlerTest, NetworkGuidInProfile) { // Add the service (simulating a network coming back in range) and verify that // the NetworkState was created with the same GUID. - AddService(wifi_path, wifi_path, shill::kTypeWifi, shill::kStateOnline); + AddService(wifi_path, "" /* guid */, wifi_name, + shill::kTypeWifi, shill::kStateOnline); UpdateManagerProperties(); network = network_state_handler_->GetNetworkStateFromServicePath( wifi_path, is_service_configured); @@ -674,10 +681,12 @@ TEST_F(NetworkStateHandlerTest, NetworkGuidInProfile) { TEST_F(NetworkStateHandlerTest, NetworkGuidNotInProfile) { const std::string wifi_path = "/service/wifi_with_guid"; + const std::string wifi_name = "WifiWithGuid"; const bool is_service_configured = false; - // Add a network without adding it to a profile. - AddService(wifi_path, wifi_path, shill::kTypeWifi, shill::kStateOnline); + // Add a network without specifying a GUID or adding it to a profile. + AddService(wifi_path, "" /* guid */, wifi_name, + shill::kTypeWifi, shill::kStateOnline); UpdateManagerProperties(); // Verify that a NetworkState exists with an assigned GUID. @@ -695,7 +704,8 @@ TEST_F(NetworkStateHandlerTest, NetworkGuidNotInProfile) { // Add the service (simulating a network coming back in range) and verify that // the NetworkState was created with the same GUID. - AddService(wifi_path, wifi_path, shill::kTypeWifi, shill::kStateOnline); + AddService(wifi_path, "" /* guid */, wifi_name, + shill::kTypeWifi, shill::kStateOnline); UpdateManagerProperties(); network = network_state_handler_->GetNetworkStateFromServicePath( wifi_path, is_service_configured); diff --git a/chromeos/network/shill_property_handler_unittest.cc b/chromeos/network/shill_property_handler_unittest.cc index 341b9cad5955..e80753156956 100644 --- a/chromeos/network/shill_property_handler_unittest.cc +++ b/chromeos/network/shill_property_handler_unittest.cc @@ -216,7 +216,12 @@ class ShillPropertyHandlerTest : public testing::Test { const std::string& state) { VLOG(2) << "AddService: " << type << ": " << id << ": " << state; ASSERT_TRUE(IsValidType(type)); - service_test_->AddService(id, id, type, state, true /* visible */); + service_test_->AddService(id /* service_path */, + id /* guid */, + id /* name */, + type, + state, + true /* visible */); } void AddServiceWithIPConfig(const std::string& type, @@ -225,7 +230,7 @@ class ShillPropertyHandlerTest : public testing::Test { const std::string& ipconfig_path) { ASSERT_TRUE(IsValidType(type)); service_test_->AddServiceWithIPConfig(id, /* service_path */ - "" /* guid */, + id /* guid */, id /* name */, type, state, @@ -236,7 +241,12 @@ class ShillPropertyHandlerTest : public testing::Test { void AddServiceToProfile(const std::string& type, const std::string& id, bool visible) { - service_test_->AddService(id, id, type, shill::kStateIdle, visible); + service_test_->AddService(id /* service_path */, + id /* guid */, + id /* name */, + type, + shill::kStateIdle, + visible); std::vector profiles; profile_test_->GetProfilePaths(&profiles); ASSERT_TRUE(profiles.size() > 0); diff --git a/components/wifi/fake_wifi_service.cc b/components/wifi/fake_wifi_service.cc index 3be2af588bd5..e1adce0b3c01 100644 --- a/components/wifi/fake_wifi_service.cc +++ b/components/wifi/fake_wifi_service.cc @@ -16,7 +16,7 @@ FakeWiFiService::FakeWiFiService() { { NetworkProperties network_properties; network_properties.connection_state = onc::connection_state::kConnected; - network_properties.guid = "stub_wifi1_GUID"; + network_properties.guid = "stub_wifi1_guid"; network_properties.name = "wifi1"; network_properties.type = onc::network_type::kWiFi; network_properties.frequency = 0; @@ -42,7 +42,7 @@ FakeWiFiService::FakeWiFiService() { { NetworkProperties network_properties; network_properties.connection_state = onc::connection_state::kNotConnected; - network_properties.guid = "stub_wifi2_GUID"; + network_properties.guid = "stub_wifi2_guid"; network_properties.name = "wifi2_PSK"; network_properties.type = onc::network_type::kWiFi; network_properties.frequency = 5000; diff --git a/ui/chromeos/network/network_icon.cc b/ui/chromeos/network/network_icon.cc index 785b99e88765..a19b868e556a 100644 --- a/ui/chromeos/network/network_icon.cc +++ b/ui/chromeos/network/network_icon.cc @@ -643,7 +643,7 @@ bool NetworkIconImpl::UpdatePortalState(const NetworkState* network) { bool behind_captive_portal = false; if (network) { NetworkPortalDetector::CaptivePortalState state = - NetworkPortalDetector::Get()->GetCaptivePortalState(network->path()); + NetworkPortalDetector::Get()->GetCaptivePortalState(network->guid()); behind_captive_portal = state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; }