OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <iostream> | 5 #include <iostream> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 EXPECT_CALL(*mock_manager_client_, | 410 EXPECT_CALL(*mock_manager_client_, |
411 ConfigureServiceForProfile( | 411 ConfigureServiceForProfile( |
412 dbus::ObjectPath(kUser1ProfilePath), | 412 dbus::ObjectPath(kUser1ProfilePath), |
413 IsEqualTo(expected_shill_properties.get()), | 413 IsEqualTo(expected_shill_properties.get()), |
414 _, _)); | 414 _, _)); |
415 | 415 |
416 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 416 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
417 message_loop_.RunUntilIdle(); | 417 message_loop_.RunUntilIdle(); |
418 } | 418 } |
419 | 419 |
| 420 TEST_F(ManagedNetworkConfigurationHandlerTest, EnableManagedCredentialsWiFi) { |
| 421 InitializeStandardProfiles(); |
| 422 scoped_ptr<base::DictionaryValue> expected_shill_properties = |
| 423 test_utils::ReadTestDictionary( |
| 424 "policy/shill_policy_autoconnect_on_unconfigured_wifi1.json"); |
| 425 |
| 426 EXPECT_CALL(*mock_profile_client_, |
| 427 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); |
| 428 |
| 429 EXPECT_CALL(*mock_manager_client_, |
| 430 ConfigureServiceForProfile( |
| 431 dbus::ObjectPath(kUser1ProfilePath), |
| 432 IsEqualTo(expected_shill_properties.get()), |
| 433 _, _)); |
| 434 |
| 435 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, |
| 436 "policy/policy_wifi1_autoconnect.onc"); |
| 437 message_loop_.RunUntilIdle(); |
| 438 } |
| 439 |
| 440 TEST_F(ManagedNetworkConfigurationHandlerTest, EnableManagedCredentialsVPN) { |
| 441 InitializeStandardProfiles(); |
| 442 scoped_ptr<base::DictionaryValue> expected_shill_properties = |
| 443 test_utils::ReadTestDictionary( |
| 444 "policy/shill_policy_autoconnect_on_unconfigured_vpn.json"); |
| 445 |
| 446 EXPECT_CALL(*mock_profile_client_, |
| 447 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); |
| 448 |
| 449 EXPECT_CALL(*mock_manager_client_, |
| 450 ConfigureServiceForProfile( |
| 451 dbus::ObjectPath(kUser1ProfilePath), |
| 452 IsEqualTo(expected_shill_properties.get()), |
| 453 _, _)); |
| 454 |
| 455 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, |
| 456 "policy/policy_vpn_autoconnect.onc"); |
| 457 message_loop_.RunUntilIdle(); |
| 458 } |
| 459 |
420 // Ensure that EAP settings for ethernet are matched with the right profile | 460 // Ensure that EAP settings for ethernet are matched with the right profile |
421 // entry and written to the dedicated EthernetEAP service. | 461 // entry and written to the dedicated EthernetEAP service. |
422 TEST_F(ManagedNetworkConfigurationHandlerTest, | 462 TEST_F(ManagedNetworkConfigurationHandlerTest, |
423 SetPolicyManageUnmanagedEthernetEAP) { | 463 SetPolicyManageUnmanagedEthernetEAP) { |
424 InitializeStandardProfiles(); | 464 InitializeStandardProfiles(); |
425 scoped_ptr<base::DictionaryValue> expected_shill_properties = | 465 scoped_ptr<base::DictionaryValue> expected_shill_properties = |
426 test_utils::ReadTestDictionary( | 466 test_utils::ReadTestDictionary( |
427 "policy/" | 467 "policy/" |
428 "shill_policy_on_unmanaged_ethernet_eap.json"); | 468 "shill_policy_on_unmanaged_ethernet_eap.json"); |
429 | 469 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 EXPECT_CALL(*mock_profile_client_, | 994 EXPECT_CALL(*mock_profile_client_, |
955 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); | 995 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); |
956 | 996 |
957 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 997 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
958 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); | 998 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); |
959 managed_network_configuration_handler_.reset(); | 999 managed_network_configuration_handler_.reset(); |
960 message_loop_.RunUntilIdle(); | 1000 message_loop_.RunUntilIdle(); |
961 } | 1001 } |
962 | 1002 |
963 } // namespace chromeos | 1003 } // namespace chromeos |
OLD | NEW |