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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 device_test_->SetDeviceProperty( | 239 device_test_->SetDeviceProperty( |
240 kCellularDevicePath, shill::kHomeProviderProperty, home_provider); | 240 kCellularDevicePath, shill::kHomeProviderProperty, home_provider); |
241 device_test_->SetDeviceProperty( | 241 device_test_->SetDeviceProperty( |
242 kCellularDevicePath, shill::kTechnologyFamilyProperty, | 242 kCellularDevicePath, shill::kTechnologyFamilyProperty, |
243 base::StringValue(shill::kNetworkTechnologyGsm)); | 243 base::StringValue(shill::kNetworkTechnologyGsm)); |
244 device_test_->SetSimLocked(kCellularDevicePath, false); | 244 device_test_->SetSimLocked(kCellularDevicePath, false); |
245 | 245 |
246 // Add the Cellular Service. | 246 // Add the Cellular Service. |
247 AddService(kCellular1ServicePath, "cellular1", shill::kTypeCellular, | 247 AddService(kCellular1ServicePath, "cellular1", shill::kTypeCellular, |
248 shill::kStateIdle); | 248 shill::kStateIdle); |
249 service_test_->SetServiceProperty(kCellular1ServicePath, | 249 service_test_->SetServiceProperty( |
250 shill::kAutoConnectProperty, | 250 kCellular1ServicePath, shill::kAutoConnectProperty, base::Value(true)); |
251 base::FundamentalValue(true)); | |
252 service_test_->SetServiceProperty( | 251 service_test_->SetServiceProperty( |
253 kCellular1ServicePath, shill::kNetworkTechnologyProperty, | 252 kCellular1ServicePath, shill::kNetworkTechnologyProperty, |
254 base::StringValue(shill::kNetworkTechnologyGsm)); | 253 base::StringValue(shill::kNetworkTechnologyGsm)); |
255 service_test_->SetServiceProperty( | 254 service_test_->SetServiceProperty( |
256 kCellular1ServicePath, shill::kActivationStateProperty, | 255 kCellular1ServicePath, shill::kActivationStateProperty, |
257 base::StringValue(shill::kActivationStateNotActivated)); | 256 base::StringValue(shill::kActivationStateNotActivated)); |
258 service_test_->SetServiceProperty( | 257 service_test_->SetServiceProperty( |
259 kCellular1ServicePath, shill::kRoamingStateProperty, | 258 kCellular1ServicePath, shill::kRoamingStateProperty, |
260 base::StringValue(shill::kRoamingStateHome)); | 259 base::StringValue(shill::kRoamingStateHome)); |
261 | 260 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 "stub_ethernet"); | 343 "stub_ethernet"); |
345 | 344 |
346 AddService(kWifi1ServicePath, "wifi1", shill::kTypeWifi, | 345 AddService(kWifi1ServicePath, "wifi1", shill::kTypeWifi, |
347 shill::kStateOnline); | 346 shill::kStateOnline); |
348 service_test_->SetServiceProperty(kWifi1ServicePath, | 347 service_test_->SetServiceProperty(kWifi1ServicePath, |
349 shill::kSecurityClassProperty, | 348 shill::kSecurityClassProperty, |
350 base::StringValue(shill::kSecurityWep)); | 349 base::StringValue(shill::kSecurityWep)); |
351 service_test_->SetServiceProperty(kWifi1ServicePath, | 350 service_test_->SetServiceProperty(kWifi1ServicePath, |
352 shill::kWifiBSsid, | 351 shill::kWifiBSsid, |
353 base::StringValue("00:01:02:03:04:05")); | 352 base::StringValue("00:01:02:03:04:05")); |
354 service_test_->SetServiceProperty(kWifi1ServicePath, | 353 service_test_->SetServiceProperty( |
355 shill::kSignalStrengthProperty, | 354 kWifi1ServicePath, shill::kSignalStrengthProperty, base::Value(40)); |
356 base::FundamentalValue(40)); | |
357 service_test_->SetServiceProperty(kWifi1ServicePath, | 355 service_test_->SetServiceProperty(kWifi1ServicePath, |
358 shill::kProfileProperty, | 356 shill::kProfileProperty, |
359 base::StringValue(kUser1ProfilePath)); | 357 base::StringValue(kUser1ProfilePath)); |
360 service_test_->SetServiceProperty(kWifi1ServicePath, | 358 service_test_->SetServiceProperty( |
361 shill::kConnectableProperty, | 359 kWifi1ServicePath, shill::kConnectableProperty, base::Value(true)); |
362 base::FundamentalValue(true)); | |
363 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kDeviceProperty, | 360 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kDeviceProperty, |
364 base::StringValue(kWifiDevicePath)); | 361 base::StringValue(kWifiDevicePath)); |
365 base::DictionaryValue static_ipconfig; | 362 base::DictionaryValue static_ipconfig; |
366 static_ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, | 363 static_ipconfig.SetStringWithoutPathExpansion(shill::kAddressProperty, |
367 "1.2.3.4"); | 364 "1.2.3.4"); |
368 service_test_->SetServiceProperty( | 365 service_test_->SetServiceProperty( |
369 kWifi1ServicePath, shill::kStaticIPConfigProperty, static_ipconfig); | 366 kWifi1ServicePath, shill::kStaticIPConfigProperty, static_ipconfig); |
370 base::ListValue frequencies1; | 367 base::ListValue frequencies1; |
371 frequencies1.AppendInteger(2400); | 368 frequencies1.AppendInteger(2400); |
372 service_test_->SetServiceProperty( | 369 service_test_->SetServiceProperty( |
373 kWifi1ServicePath, shill::kWifiFrequencyListProperty, frequencies1); | 370 kWifi1ServicePath, shill::kWifiFrequencyListProperty, frequencies1); |
374 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kWifiFrequency, | 371 service_test_->SetServiceProperty(kWifi1ServicePath, shill::kWifiFrequency, |
375 base::FundamentalValue(2400)); | 372 base::Value(2400)); |
376 profile_test_->AddService(kUser1ProfilePath, kWifi1ServicePath); | 373 profile_test_->AddService(kUser1ProfilePath, kWifi1ServicePath); |
377 | 374 |
378 AddService(kWifi2ServicePath, "wifi2_PSK", shill::kTypeWifi, | 375 AddService(kWifi2ServicePath, "wifi2_PSK", shill::kTypeWifi, |
379 shill::kStateIdle); | 376 shill::kStateIdle); |
380 service_test_->SetServiceProperty(kWifi2ServicePath, | 377 service_test_->SetServiceProperty(kWifi2ServicePath, |
381 shill::kSecurityClassProperty, | 378 shill::kSecurityClassProperty, |
382 base::StringValue(shill::kSecurityPsk)); | 379 base::StringValue(shill::kSecurityPsk)); |
383 service_test_->SetServiceProperty(kWifi2ServicePath, | 380 service_test_->SetServiceProperty( |
384 shill::kSignalStrengthProperty, | 381 kWifi2ServicePath, shill::kSignalStrengthProperty, base::Value(80)); |
385 base::FundamentalValue(80)); | 382 service_test_->SetServiceProperty( |
386 service_test_->SetServiceProperty(kWifi2ServicePath, | 383 kWifi2ServicePath, shill::kConnectableProperty, base::Value(true)); |
387 shill::kConnectableProperty, | |
388 base::FundamentalValue(true)); | |
389 | 384 |
390 AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline); | 385 AddService("stub_wimax", "wimax", shill::kTypeWimax, shill::kStateOnline); |
391 service_test_->SetServiceProperty("stub_wimax", | 386 service_test_->SetServiceProperty( |
392 shill::kSignalStrengthProperty, | 387 "stub_wimax", shill::kSignalStrengthProperty, base::Value(40)); |
393 base::FundamentalValue(40)); | |
394 service_test_->SetServiceProperty("stub_wimax", shill::kProfileProperty, | 388 service_test_->SetServiceProperty("stub_wimax", shill::kProfileProperty, |
395 base::StringValue(kUser1ProfilePath)); | 389 base::StringValue(kUser1ProfilePath)); |
396 service_test_->SetServiceProperty("stub_wimax", shill::kConnectableProperty, | 390 service_test_->SetServiceProperty("stub_wimax", shill::kConnectableProperty, |
397 base::FundamentalValue(true)); | 391 base::Value(true)); |
398 profile_test_->AddService(kUser1ProfilePath, "stub_wimax"); | 392 profile_test_->AddService(kUser1ProfilePath, "stub_wimax"); |
399 | 393 |
400 base::ListValue frequencies2; | 394 base::ListValue frequencies2; |
401 frequencies2.AppendInteger(2400); | 395 frequencies2.AppendInteger(2400); |
402 frequencies2.AppendInteger(5000); | 396 frequencies2.AppendInteger(5000); |
403 service_test_->SetServiceProperty( | 397 service_test_->SetServiceProperty( |
404 kWifi2ServicePath, shill::kWifiFrequencyListProperty, frequencies2); | 398 kWifi2ServicePath, shill::kWifiFrequencyListProperty, frequencies2); |
405 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kWifiFrequency, | 399 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kWifiFrequency, |
406 base::FundamentalValue(5000)); | 400 base::Value(5000)); |
407 service_test_->SetServiceProperty(kWifi2ServicePath, | 401 service_test_->SetServiceProperty(kWifi2ServicePath, |
408 shill::kProfileProperty, | 402 shill::kProfileProperty, |
409 base::StringValue(kUser1ProfilePath)); | 403 base::StringValue(kUser1ProfilePath)); |
410 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); | 404 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); |
411 | 405 |
412 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); | 406 AddService("stub_vpn1", "vpn1", shill::kTypeVPN, shill::kStateOnline); |
413 service_test_->SetServiceProperty( | 407 service_test_->SetServiceProperty( |
414 "stub_vpn1", shill::kProviderTypeProperty, | 408 "stub_vpn1", shill::kProviderTypeProperty, |
415 base::StringValue(shill::kProviderOpenVpn)); | 409 base::StringValue(shill::kProviderOpenVpn)); |
416 profile_test_->AddService(kUser1ProfilePath, "stub_vpn1"); | 410 profile_test_->AddService(kUser1ProfilePath, "stub_vpn1"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 473 |
480 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, | 474 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, |
481 StartGetPropertiesNonexistent) { | 475 StartGetPropertiesNonexistent) { |
482 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) | 476 EXPECT_TRUE(RunNetworkingSubtest("startGetPropertiesNonexistent")) |
483 << message_; | 477 << message_; |
484 } | 478 } |
485 | 479 |
486 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetNetworks) { | 480 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetNetworks) { |
487 // Hide stub_wifi2. | 481 // Hide stub_wifi2. |
488 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kVisibleProperty, | 482 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kVisibleProperty, |
489 base::FundamentalValue(false)); | 483 base::Value(false)); |
490 // Add a couple of additional networks that are not configured (saved). | 484 // Add a couple of additional networks that are not configured (saved). |
491 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); | 485 AddService("stub_wifi3", "wifi3", shill::kTypeWifi, shill::kStateIdle); |
492 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); | 486 AddService("stub_wifi4", "wifi4", shill::kTypeWifi, shill::kStateIdle); |
493 content::RunAllPendingInMessageLoop(); | 487 content::RunAllPendingInMessageLoop(); |
494 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; | 488 EXPECT_TRUE(RunNetworkingSubtest("getNetworks")) << message_; |
495 } | 489 } |
496 | 490 |
497 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetVisibleNetworks) { | 491 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetVisibleNetworks) { |
498 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; | 492 EXPECT_TRUE(RunNetworkingSubtest("getVisibleNetworks")) << message_; |
499 } | 493 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // TODO(stevenjb): Find a better way to set this up on Chrome OS. | 560 // TODO(stevenjb): Find a better way to set this up on Chrome OS. |
567 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetManagedProperties) { | 561 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, GetManagedProperties) { |
568 const std::string uidata_blob = | 562 const std::string uidata_blob = |
569 "{ \"user_settings\": {" | 563 "{ \"user_settings\": {" |
570 " \"WiFi\": {" | 564 " \"WiFi\": {" |
571 " \"Passphrase\": \"FAKE_CREDENTIAL_VPaJDV9x\" }" | 565 " \"Passphrase\": \"FAKE_CREDENTIAL_VPaJDV9x\" }" |
572 " }" | 566 " }" |
573 "}"; | 567 "}"; |
574 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kUIDataProperty, | 568 service_test_->SetServiceProperty(kWifi2ServicePath, shill::kUIDataProperty, |
575 base::StringValue(uidata_blob)); | 569 base::StringValue(uidata_blob)); |
576 service_test_->SetServiceProperty(kWifi2ServicePath, | 570 service_test_->SetServiceProperty( |
577 shill::kAutoConnectProperty, | 571 kWifi2ServicePath, shill::kAutoConnectProperty, base::Value(false)); |
578 base::FundamentalValue(false)); | |
579 | 572 |
580 // Update the profile entry. | 573 // Update the profile entry. |
581 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); | 574 profile_test_->AddService(kUser1ProfilePath, kWifi2ServicePath); |
582 | 575 |
583 content::RunAllPendingInMessageLoop(); | 576 content::RunAllPendingInMessageLoop(); |
584 | 577 |
585 const std::string user_policy_blob = | 578 const std::string user_policy_blob = |
586 "{ \"NetworkConfigurations\": [" | 579 "{ \"NetworkConfigurations\": [" |
587 " { \"GUID\": \"stub_wifi2\"," | 580 " { \"GUID\": \"stub_wifi2\"," |
588 " \"Type\": \"WiFi\"," | 581 " \"Type\": \"WiFi\"," |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 729 } |
737 | 730 |
738 // Tests subset of networking API for the networking API alias - to verify that | 731 // Tests subset of networking API for the networking API alias - to verify that |
739 // using API methods and event does not cause access exceptions (due to | 732 // using API methods and event does not cause access exceptions (due to |
740 // missing permissions). | 733 // missing permissions). |
741 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, Alias) { | 734 IN_PROC_BROWSER_TEST_F(NetworkingPrivateChromeOSApiTest, Alias) { |
742 EXPECT_TRUE(RunPlatformAppTest("networking_private/alias")) << message_; | 735 EXPECT_TRUE(RunPlatformAppTest("networking_private/alias")) << message_; |
743 } | 736 } |
744 | 737 |
745 } // namespace | 738 } // namespace |
OLD | NEW |