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