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 "chromeos/network/managed_network_configuration_handler.h" | 5 #include "chromeos/network/managed_network_configuration_handler.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 void SetPolicy(onc::ONCSource onc_source, | 106 void SetPolicy(onc::ONCSource onc_source, |
107 const std::string& path_to_onc) { | 107 const std::string& path_to_onc) { |
108 scoped_ptr<base::DictionaryValue> policy; | 108 scoped_ptr<base::DictionaryValue> policy; |
109 if (path_to_onc.empty()) | 109 if (path_to_onc.empty()) |
110 policy = onc::ReadDictionaryFromJson(onc::kEmptyUnencryptedConfiguration); | 110 policy = onc::ReadDictionaryFromJson(onc::kEmptyUnencryptedConfiguration); |
111 else | 111 else |
112 policy = test_utils::ReadTestDictionary(path_to_onc); | 112 policy = test_utils::ReadTestDictionary(path_to_onc); |
113 | 113 |
114 managed_handler()->SetPolicy(onc::ONC_SOURCE_USER_POLICY, *policy); | 114 base::ListValue* network_configs = NULL; |
| 115 policy->GetListWithoutPathExpansion( |
| 116 onc::toplevel_config::kNetworkConfigurations, &network_configs); |
| 117 |
| 118 managed_handler()->SetPolicy(onc::ONC_SOURCE_USER_POLICY, *network_configs); |
115 } | 119 } |
116 | 120 |
117 ManagedNetworkConfigurationHandler* managed_handler() { | 121 ManagedNetworkConfigurationHandler* managed_handler() { |
118 return ManagedNetworkConfigurationHandler::Get(); | 122 return ManagedNetworkConfigurationHandler::Get(); |
119 } | 123 } |
120 | 124 |
121 protected: | 125 protected: |
122 StrictMock<MockShillManagerClient> mock_manager_client_; | 126 StrictMock<MockShillManagerClient> mock_manager_client_; |
123 StrictMock<MockShillServiceClient> mock_service_client_; | 127 StrictMock<MockShillServiceClient> mock_service_client_; |
124 StrictMock<MockShillProfileClient> mock_profile_client_; | 128 StrictMock<MockShillProfileClient> mock_profile_client_; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 EXPECT_CALL(mock_profile_client_, | 309 EXPECT_CALL(mock_profile_client_, |
306 GetEntry(dbus::ObjectPath("/profile/chronos/shill"), | 310 GetEntry(dbus::ObjectPath("/profile/chronos/shill"), |
307 "old_entry_path", | 311 "old_entry_path", |
308 _, _)).Times(1); | 312 _, _)).Times(1); |
309 | 313 |
310 SetPolicy(onc::ONC_SOURCE_USER_POLICY, ""); | 314 SetPolicy(onc::ONC_SOURCE_USER_POLICY, ""); |
311 message_loop_.RunUntilIdle(); | 315 message_loop_.RunUntilIdle(); |
312 } | 316 } |
313 | 317 |
314 } // namespace chromeos | 318 } // namespace chromeos |
OLD | NEW |