| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 device_test_->SetDeviceProperty( | 237 device_test_->SetDeviceProperty( |
| 238 kCellularDevicePath, shill::kTechnologyFamilyProperty, | 238 kCellularDevicePath, shill::kTechnologyFamilyProperty, |
| 239 base::StringValue(shill::kNetworkTechnologyGsm)); | 239 base::StringValue(shill::kNetworkTechnologyGsm)); |
| 240 device_test_->SetSimLocked(kCellularDevicePath, false); | 240 device_test_->SetSimLocked(kCellularDevicePath, false); |
| 241 | 241 |
| 242 // Add the Cellular Service. | 242 // Add the Cellular Service. |
| 243 AddService(kCellular1ServicePath, "cellular1", shill::kTypeCellular, | 243 AddService(kCellular1ServicePath, "cellular1", shill::kTypeCellular, |
| 244 shill::kStateIdle); | 244 shill::kStateIdle); |
| 245 service_test_->SetServiceProperty(kCellular1ServicePath, | 245 service_test_->SetServiceProperty(kCellular1ServicePath, |
| 246 shill::kAutoConnectProperty, | 246 shill::kAutoConnectProperty, |
| 247 base::FundamentalValue(true)); | 247 base::Value(true)); |
| 248 service_test_->SetServiceProperty( | 248 service_test_->SetServiceProperty( |
| 249 kCellular1ServicePath, shill::kNetworkTechnologyProperty, | 249 kCellular1ServicePath, shill::kNetworkTechnologyProperty, |
| 250 base::StringValue(shill::kNetworkTechnologyGsm)); | 250 base::StringValue(shill::kNetworkTechnologyGsm)); |
| 251 service_test_->SetServiceProperty( | 251 service_test_->SetServiceProperty( |
| 252 kCellular1ServicePath, shill::kActivationStateProperty, | 252 kCellular1ServicePath, shill::kActivationStateProperty, |
| 253 base::StringValue(shill::kActivationStateNotActivated)); | 253 base::StringValue(shill::kActivationStateNotActivated)); |
| 254 service_test_->SetServiceProperty( | 254 service_test_->SetServiceProperty( |
| 255 kCellular1ServicePath, shill::kRoamingStateProperty, | 255 kCellular1ServicePath, shill::kRoamingStateProperty, |
| 256 base::StringValue(shill::kRoamingStateHome)); | 256 base::StringValue(shill::kRoamingStateHome)); |
| 257 | 257 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 AddService(kWifi1ServicePath, "wifi1", shill::kTypeWifi, | 342 AddService(kWifi1ServicePath, "wifi1", shill::kTypeWifi, |
| 343 shill::kStateOnline); | 343 shill::kStateOnline); |
| 344 service_test_->SetServiceProperty(kWifi1ServicePath, | 344 service_test_->SetServiceProperty(kWifi1ServicePath, |
| 345 shill::kSecurityClassProperty, | 345 shill::kSecurityClassProperty, |
| 346 base::StringValue(shill::kSecurityWep)); | 346 base::StringValue(shill::kSecurityWep)); |
| 347 service_test_->SetServiceProperty(kWifi1ServicePath, | 347 service_test_->SetServiceProperty(kWifi1ServicePath, |
| 348 shill::kWifiBSsid, | 348 shill::kWifiBSsid, |
| 349 base::StringValue("00:01:02:03:04:05")); | 349 base::StringValue("00:01:02:03:04:05")); |
| 350 service_test_->SetServiceProperty(kWifi1ServicePath, | 350 service_test_->SetServiceProperty(kWifi1ServicePath, |
| 351 shill::kSignalStrengthProperty, | 351 shill::kSignalStrengthProperty, |
| 352 base::FundamentalValue(40)); | 352 base::Value(40)); |
| 353 service_test_->SetServiceProperty(kWifi1ServicePath, | 353 service_test_->SetServiceProperty(kWifi1ServicePath, |
| 354 shill::kProfileProperty, | 354 shill::kProfileProperty, |
| 355 base::StringValue(kUser1ProfilePath)); | 355 base::StringValue(kUser1ProfilePath)); |
| 356 service_test_->SetServiceProperty(kWifi1ServicePath, | 356 service_test_->SetServiceProperty(kWifi1ServicePath, |
| 357 shill::kConnectableProperty, | 357 shill::kConnectableProperty, |
| 358 base::FundamentalValue(true)); | 358 base::Value(true)); |
| 359 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kDeviceProperty, | 359 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kDeviceProperty, |
| 360 base::StringValue(kWifiDevicePath)); | 360 base::StringValue(kWifiDevicePath)); |
| 361 base::DictionaryValue static_ipconfig; | 361 base::DictionaryValue static_ipconfig; |
| 362 static_ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, | 362 static_ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, |
| 363 "1.2.3.4"); | 363 "1.2.3.4"); |
| 364 service_test_->SetServiceProperty( | 364 service_test_->SetServiceProperty( |
| 365 kWifi1ServicePath, shill::kStaticIPConfigProperty, static_ipconfig); | 365 kWifi1ServicePath, shill::kStaticIPConfigProperty, static_ipconfig); |
| 366 base::ListValue frequencies1; | 366 base::ListValue frequencies1; |
| 367 frequencies1.AppendInteger(2400); | 367 frequencies1.AppendInteger(2400); |
| 368 service_test_->SetServiceProperty( | 368 service_test_->SetServiceProperty( |
| 369 kWifi1ServicePath, shill::kWifiFrequencyListProperty, frequencies1); | 369 kWifi1ServicePath, shill::kWifiFrequencyListProperty, frequencies1); |
| 370 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kWifiFrequency, | 370 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kWifiFrequency, |
| 371 base::FundamentalValue(2400)); | 371 base::Value(2400)); |
| 372 profile_test_->AddService(kUser1ProfilePath, kWifi1ServicePath); | 372 profile_test_->AddService(kUser1ProfilePath, kWifi1ServicePath); |
| 373 | 373 |
| 374 AddService(kWifi2ServicePath, "wifi2_PSK", shill::kTypeWifi, | 374 AddService(kWifi2ServicePath, "wifi2_PSK", shill::kTypeWifi, |
| 375 shill::kStateIdle); | 375 shill::kStateIdle); |
| 376 service_test_->SetServiceProperty(kWifi2ServicePath, | 376 service_test_->SetServiceProperty(kWifi2ServicePath, |
| 377 shill::kSecurityClassProperty, | 377 shill::kSecurityClassProperty, |
| 378 base::StringValue(shill::kSecurityPsk)); | 378 base::StringValue(shill::kSecurityPsk)); |
| 379 service_test_->SetServiceProperty(kWifi2ServicePath, | 379 service_test_->SetServiceProperty(kWifi2ServicePath, |
| 380 shill::kSignalStrengthProperty, | 380 shill::kSignalStrengthProperty, |
| 381 base::FundamentalValue(80)); | 381 base::Value(80)); |
| 382 service_test_->SetServiceProperty(kWifi2ServicePath, | 382 service_test_->SetServiceProperty(kWifi2ServicePath, |
| 383 shill::kConnectableProperty, | 383 shill::kConnectableProperty, |
| 384 base::FundamentalValue(true)); | 384 base::Value(true)); |
| 385 | 385 |
| 386 AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline); | 386 AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline); |
| 387 service_test_->SetServiceProperty("stub_wimax", | 387 service_test_->SetServiceProperty("stub_wimax", |
| 388 shill::kSignalStrengthProperty, | 388 shill::kSignalStrengthProperty, |
| 389 base::FundamentalValue(40)); | 389 base::Value(40)); |
| 390 service_test_->SetServiceProperty("stub_wimax", shill::kProfileProperty, | 390 service_test_->SetServiceProperty("stub_wimax", shill::kProfileProperty, |
| 391 base::StringValue(kUser1ProfilePath)); | 391 base::StringValue(kUser1ProfilePath)); |
| 392 service_test_->SetServiceProperty("stub_wimax", shill::kConnectableProperty, | 392 service_test_->SetServiceProperty("stub_wimax", shill::kConnectableProperty, |
| 393 base::FundamentalValue(true)); | 393 base::Value(true)); |
| 394 profile_test_->AddService(kUser1ProfilePath, "stub_wimax"); | 394 profile_test_->AddService(kUser1ProfilePath, "stub_wimax"); |
| 395 | 395 |
| 396 base::ListValue frequencies2; | 396 base::ListValue frequencies2; |
| 397 frequencies2.AppendInteger(2400); | 397 frequencies2.AppendInteger(2400); |
| 398 frequencies2.AppendInteger(5000); | 398 frequencies2.AppendInteger(5000); |
| 399 service_test_->SetServiceProperty( | 399 service_test_->SetServiceProperty( |
| 400 kWifi2ServicePath, shill::kWifiFrequencyListProperty, frequencies2); | 400 kWifi2ServicePath, shill::kWifiFrequencyListProperty, frequencies2); |
| 401 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kWifiFrequency, | 401 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kWifiFrequency, |
| 402 base::FundamentalValue(5000)); | 402 base::Value(5000)); |
| 403 service_test_->SetServiceProperty(kWifi2ServicePath, | 403 service_test_->SetServiceProperty(kWifi2ServicePath, |
| 404 shill::kProfileProperty, | 404 shill::kProfileProperty, |
| 405 base::StringValue(kUser1ProfilePath)); | 405 base::StringValue(kUser1ProfilePath)); |
| 406 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); | 406 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); |
| 407 | 407 |
| 408 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); | 408 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); |
| 409 service_test_->SetServiceProperty( | 409 service_test_->SetServiceProperty( |
| 410 "stub_vpn1", shill::kProviderTypeProperty, | 410 "stub_vpn1", shill::kProviderTypeProperty, |
| 411 base::StringValue(shill::kProviderOpenVpn)); | 411 base::StringValue(shill::kProviderOpenVpn)); |
| 412 profile_test_->AddService(kUser1ProfilePath, "stub_vpn1"); | 412 profile_test_->AddService(kUser1ProfilePath, "stub_vpn1"); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, | 476 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, |
| 477 StartGetPropertiesNonexistent) { | 477 StartGetPropertiesNonexistent) { |
| 478 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) | 478 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) |
| 479 << message_; | 479 << message_; |
| 480 } | 480 } |
| 481 | 481 |
| 482 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetNetworks) { | 482 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetNetworks) { |
| 483 // Hide stub_wifi2. | 483 // Hide stub_wifi2. |
| 484 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kVisibleProperty, | 484 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kVisibleProperty, |
| 485 base::FundamentalValue(false)); | 485 base::Value(false)); |
| 486 // Add a couple of additional networks that are not configured (saved). | 486 // Add a couple of additional networks that are not configured (saved). |
| 487 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); | 487 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); |
| 488 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); | 488 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); |
| 489 content::RunAllPendingInMessageLoop(); | 489 content::RunAllPendingInMessageLoop(); |
| 490 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; | 490 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; |
| 491 } | 491 } |
| 492 | 492 |
| 493 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetVisibleNetworks) { | 493 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetVisibleNetworks) { |
| 494 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; | 494 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; |
| 495 } | 495 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 const std::string uidata_blob = | 564 const std::string uidata_blob = |
| 565 "{ \"user_settings\": {" | 565 "{ \"user_settings\": {" |
| 566 " \"WiFi\": {" | 566 " \"WiFi\": {" |
| 567 " \"Passphrase\": \"FAKE_CREDENTIAL_VPaJDV9x\" }" | 567 " \"Passphrase\": \"FAKE_CREDENTIAL_VPaJDV9x\" }" |
| 568 " }" | 568 " }" |
| 569 "}"; | 569 "}"; |
| 570 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kUIDataProperty, | 570 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kUIDataProperty, |
| 571 base::StringValue(uidata_blob)); | 571 base::StringValue(uidata_blob)); |
| 572 service_test_->SetServiceProperty(kWifi2ServicePath, | 572 service_test_->SetServiceProperty(kWifi2ServicePath, |
| 573 shill::kAutoConnectProperty, | 573 shill::kAutoConnectProperty, |
| 574 base::FundamentalValue(false)); | 574 base::Value(false)); |
| 575 | 575 |
| 576 // Update the profile entry. | 576 // Update the profile entry. |
| 577 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); | 577 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); |
| 578 | 578 |
| 579 content::RunAllPendingInMessageLoop(); | 579 content::RunAllPendingInMessageLoop(); |
| 580 | 580 |
| 581 const std::string user_policy_blob = | 581 const std::string user_policy_blob = |
| 582 "{ \"NetworkConfigurations\": [" | 582 "{ \"NetworkConfigurations\": [" |
| 583 " { \"GUID\": \"stub_wifi2\"," | 583 " { \"GUID\": \"stub_wifi2\"," |
| 584 " \"Type\": \"WiFi\"," | 584 " \"Type\": \"WiFi\"," |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 707 } |
| 708 | 708 |
| 709 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, CellularSimPuk) { | 709 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, CellularSimPuk) { |
| 710 SetupCellular(); | 710 SetupCellular(); |
| 711 // Lock the SIM | 711 // Lock the SIM |
| 712 device_test_->SetSimLocked(kCellularDevicePath, true); | 712 device_test_->SetSimLocked(kCellularDevicePath, true); |
| 713 EXPECT_TRUE(RunNetworkingSubtest("cellularSimPuk")) << message_; | 713 EXPECT_TRUE(RunNetworkingSubtest("cellularSimPuk")) << message_; |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace | 716 } // namespace |
| OLD | NEW |