| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/users/user.h" | 10 #include "chrome/browser/chromeos/login/users/user.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 shill::kNetworkTechnologyProperty, | 218 shill::kNetworkTechnologyProperty, |
| 219 base::StringValue(shill::kNetworkTechnologyGsm)); | 219 base::StringValue(shill::kNetworkTechnologyGsm)); |
| 220 service_test_->SetServiceProperty( | 220 service_test_->SetServiceProperty( |
| 221 "stub_cellular1", | 221 "stub_cellular1", |
| 222 shill::kActivationStateProperty, | 222 shill::kActivationStateProperty, |
| 223 base::StringValue(shill::kActivationStateNotActivated)); | 223 base::StringValue(shill::kActivationStateNotActivated)); |
| 224 service_test_->SetServiceProperty( | 224 service_test_->SetServiceProperty( |
| 225 "stub_cellular1", | 225 "stub_cellular1", |
| 226 shill::kRoamingStateProperty, | 226 shill::kRoamingStateProperty, |
| 227 base::StringValue(shill::kRoamingStateHome)); | 227 base::StringValue(shill::kRoamingStateHome)); |
| 228 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | |
| 229 SortManagerServices(); | |
| 230 content::RunAllPendingInMessageLoop(); | 228 content::RunAllPendingInMessageLoop(); |
| 231 } | 229 } |
| 232 | 230 |
| 233 void AddService(const std::string& service_path, | 231 void AddService(const std::string& service_path, |
| 234 const std::string& name, | 232 const std::string& name, |
| 235 const std::string& type, | 233 const std::string& type, |
| 236 const std::string& state) { | 234 const std::string& state) { |
| 237 const bool add_to_visible = true; | 235 const bool add_to_visible = true; |
| 238 // Tests need a known GUID, so use 'service_path'. | 236 // Tests need a known GUID, so use 'service_path'. |
| 239 service_test_->AddServiceWithIPConfig( | 237 service_test_->AddServiceWithIPConfig( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 256 service_test_ = dbus_manager->GetShillServiceClient()->GetTestInterface(); | 254 service_test_ = dbus_manager->GetShillServiceClient()->GetTestInterface(); |
| 257 device_test_ = dbus_manager->GetShillDeviceClient()->GetTestInterface(); | 255 device_test_ = dbus_manager->GetShillDeviceClient()->GetTestInterface(); |
| 258 | 256 |
| 259 ShillIPConfigClient::TestInterface* ip_config_test = | 257 ShillIPConfigClient::TestInterface* ip_config_test = |
| 260 dbus_manager->GetShillIPConfigClient()->GetTestInterface(); | 258 dbus_manager->GetShillIPConfigClient()->GetTestInterface(); |
| 261 ShillProfileClient::TestInterface* profile_test = | 259 ShillProfileClient::TestInterface* profile_test = |
| 262 dbus_manager->GetShillProfileClient()->GetTestInterface(); | 260 dbus_manager->GetShillProfileClient()->GetTestInterface(); |
| 263 | 261 |
| 264 device_test_->ClearDevices(); | 262 device_test_->ClearDevices(); |
| 265 service_test_->ClearServices(); | 263 service_test_->ClearServices(); |
| 266 profile_test->ClearProfiles(); | |
| 267 | 264 |
| 268 // Sends a notification about the added profile. | 265 // Sends a notification about the added profile. |
| 269 profile_test->AddProfile(kUser1ProfilePath, userhash_); | 266 profile_test->AddProfile(kUser1ProfilePath, userhash_); |
| 270 | 267 |
| 271 // Add IPConfigs | 268 // Add IPConfigs |
| 272 base::DictionaryValue ipconfig; | 269 base::DictionaryValue ipconfig; |
| 273 ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0"); | 270 ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, "0.0.0.0"); |
| 274 ipconfig.SetStringWithoutPathExpansion(shill::kGatewayProperty, "0.0.0.1"); | 271 ipconfig.SetStringWithoutPathExpansion(shill::kGatewayProperty, "0.0.0.1"); |
| 275 ipconfig.SetIntegerWithoutPathExpansion(shill::kPrefixlenProperty, 0); | 272 ipconfig.SetIntegerWithoutPathExpansion(shill::kPrefixlenProperty, 0); |
| 276 ipconfig.SetStringWithoutPathExpansion(shill::kMethodProperty, | 273 ipconfig.SetStringWithoutPathExpansion(shill::kMethodProperty, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 service_test_->SetServiceProperty("stub_wifi2", | 344 service_test_->SetServiceProperty("stub_wifi2", |
| 348 shill::kWifiFrequency, | 345 shill::kWifiFrequency, |
| 349 base::FundamentalValue(5000)); | 346 base::FundamentalValue(5000)); |
| 350 service_test_->SetServiceProperty("stub_wifi2", | 347 service_test_->SetServiceProperty("stub_wifi2", |
| 351 shill::kProfileProperty, | 348 shill::kProfileProperty, |
| 352 base::StringValue(kUser1ProfilePath)); | 349 base::StringValue(kUser1ProfilePath)); |
| 353 profile_test->AddService(kUser1ProfilePath, "stub_wifi2"); | 350 profile_test->AddService(kUser1ProfilePath, "stub_wifi2"); |
| 354 | 351 |
| 355 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); | 352 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); |
| 356 | 353 |
| 357 manager_test_->SortManagerServices(); | |
| 358 | |
| 359 content::RunAllPendingInMessageLoop(); | 354 content::RunAllPendingInMessageLoop(); |
| 360 } | 355 } |
| 361 #else // !defined(OS_CHROMEOS) | 356 #else // !defined(OS_CHROMEOS) |
| 362 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 357 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 363 ExtensionApiTest::SetUpCommandLine(command_line); | 358 ExtensionApiTest::SetUpCommandLine(command_line); |
| 364 // Whitelist the extension ID of the test extension. | 359 // Whitelist the extension ID of the test extension. |
| 365 command_line->AppendSwitchASCII( | 360 command_line->AppendSwitchASCII( |
| 366 extensions::switches::kWhitelistedExtensionID, | 361 extensions::switches::kWhitelistedExtensionID, |
| 367 "epcifkihnkjgphfkloaaleeakhpmgdmn"); | 362 "epcifkihnkjgphfkloaaleeakhpmgdmn"); |
| 368 } | 363 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 415 |
| 421 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | 416 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, |
| 422 StartGetPropertiesNonexistent) { | 417 StartGetPropertiesNonexistent) { |
| 423 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) | 418 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) |
| 424 << message_; | 419 << message_; |
| 425 } | 420 } |
| 426 | 421 |
| 427 #if defined(OS_CHROMEOS) | 422 #if defined(OS_CHROMEOS) |
| 428 // TODO(stevenjb/mef): Fix these on non-Chrome OS, crbug.com/371442. | 423 // TODO(stevenjb/mef): Fix these on non-Chrome OS, crbug.com/371442. |
| 429 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetNetworks) { | 424 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetNetworks) { |
| 430 // Remove "stub_wifi2" from the visible list. | 425 // Hide stub_wifi2. |
| 431 manager_test_->RemoveManagerService("stub_wifi2", false); | 426 service_test_->SetServiceProperty("stub_wifi2", |
| 427 shill::kVisibleProperty, |
| 428 base::FundamentalValue(false)); |
| 432 // Add a couple of additional networks that are not configured (saved). | 429 // Add a couple of additional networks that are not configured (saved). |
| 433 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); | 430 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); |
| 434 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); | 431 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); |
| 432 content::RunAllPendingInMessageLoop(); |
| 435 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; | 433 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; |
| 436 } | 434 } |
| 437 | 435 |
| 438 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { | 436 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, GetVisibleNetworks) { |
| 439 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; | 437 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; |
| 440 } | 438 } |
| 441 #endif | 439 #endif |
| 442 | 440 |
| 443 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, | 441 IN_PROC_BROWSER_TEST_F(ExtensionNetworkingPrivateApiTest, |
| 444 GetVisibleNetworksWifi) { | 442 GetVisibleNetworksWifi) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 615 |
| 618 TestListener listener( | 616 TestListener listener( |
| 619 "notifyPortalDetectorObservers", | 617 "notifyPortalDetectorObservers", |
| 620 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, | 618 base::Bind(&NetworkPortalDetectorTestImpl::NotifyObserversForTesting, |
| 621 base::Unretained(detector()))); | 619 base::Unretained(detector()))); |
| 622 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; | 620 EXPECT_TRUE(RunNetworkingSubtest("captivePortalNotification")) << message_; |
| 623 } | 621 } |
| 624 #endif // defined(OS_CHROMEOS) | 622 #endif // defined(OS_CHROMEOS) |
| 625 | 623 |
| 626 } // namespace | 624 } // namespace |
| OLD | NEW |