| 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 ConfigureServiceForProfile( | 718 ConfigureServiceForProfile( |
| 719 dbus::ObjectPath(kUser1ProfilePath), | 719 dbus::ObjectPath(kUser1ProfilePath), |
| 720 IsEqualTo(expected_shill_properties.get()), | 720 IsEqualTo(expected_shill_properties.get()), |
| 721 _, _)); | 721 _, _)); |
| 722 | 722 |
| 723 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_vpn.onc"); | 723 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_vpn.onc"); |
| 724 message_loop_.RunUntilIdle(); | 724 message_loop_.RunUntilIdle(); |
| 725 VerifyAndClearExpectations(); | 725 VerifyAndClearExpectations(); |
| 726 } | 726 } |
| 727 | 727 |
| 728 TEST_F(ManagedNetworkConfigurationHandlerTest, | |
| 729 SetPolicyUpdateManagedEquivalentSecurity) { | |
| 730 InitializeStandardProfiles(); | |
| 731 SetUpEntry("policy/shill_managed_wifi1_rsn.json", | |
| 732 kUser1ProfilePath, | |
| 733 "old_entry_path"); | |
| 734 | |
| 735 scoped_ptr<base::DictionaryValue> expected_shill_properties = | |
| 736 test_utils::ReadTestDictionary( | |
| 737 "policy/shill_policy_on_unmanaged_wifi1.json"); | |
| 738 | |
| 739 // The passphrase isn't sent again, because it's configured by the user and | |
| 740 // Shill doesn't send it on GetProperties calls. | |
| 741 expected_shill_properties->RemoveWithoutPathExpansion( | |
| 742 shill::kPassphraseProperty, NULL); | |
| 743 | |
| 744 EXPECT_CALL(*mock_profile_client_, | |
| 745 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); | |
| 746 | |
| 747 EXPECT_CALL( | |
| 748 *mock_profile_client_, | |
| 749 GetEntry(dbus::ObjectPath(kUser1ProfilePath), "old_entry_path", _, _)); | |
| 750 | |
| 751 // The existing entry must not be deleted because the Security type 'rsa' is | |
| 752 // equivalent to 'psk' when identifying networks. | |
| 753 | |
| 754 EXPECT_CALL( | |
| 755 *mock_manager_client_, | |
| 756 ConfigureServiceForProfile(dbus::ObjectPath(kUser1ProfilePath), | |
| 757 IsEqualTo(expected_shill_properties.get()), | |
| 758 _, _)); | |
| 759 | |
| 760 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | |
| 761 message_loop_.RunUntilIdle(); | |
| 762 } | |
| 763 | |
| 764 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyReapplyToManaged) { | 728 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyReapplyToManaged) { |
| 765 InitializeStandardProfiles(); | 729 InitializeStandardProfiles(); |
| 766 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json", | 730 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json", |
| 767 kUser1ProfilePath, | 731 kUser1ProfilePath, |
| 768 "old_entry_path"); | 732 "old_entry_path"); |
| 769 | 733 |
| 770 scoped_ptr<base::DictionaryValue> expected_shill_properties = | 734 scoped_ptr<base::DictionaryValue> expected_shill_properties = |
| 771 test_utils::ReadTestDictionary( | 735 test_utils::ReadTestDictionary( |
| 772 "policy/shill_policy_on_unmanaged_wifi1.json"); | 736 "policy/shill_policy_on_unmanaged_wifi1.json"); |
| 773 | 737 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 EXPECT_CALL(*mock_profile_client_, | 959 EXPECT_CALL(*mock_profile_client_, |
| 996 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); | 960 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); |
| 997 | 961 |
| 998 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 962 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
| 999 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); | 963 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); |
| 1000 managed_network_configuration_handler_.reset(); | 964 managed_network_configuration_handler_.reset(); |
| 1001 message_loop_.RunUntilIdle(); | 965 message_loop_.RunUntilIdle(); |
| 1002 } | 966 } |
| 1003 | 967 |
| 1004 } // namespace chromeos | 968 } // namespace chromeos |
| OLD | NEW |