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
3 // found in the LICENSE file.
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h"
11 #include "chromeos/dbus/dbus_thread_manager.h"
12 #include "chromeos/dbus/fake_dbus_thread_manager.h"
13 #include "chromeos/dbus/mock_shill_manager_client.h"
14 #include "chromeos/dbus/mock_shill_profile_client.h"
15 #include "chromeos/network/managed_network_configuration_handler_impl.h"
16 #include "chromeos/network/network_configuration_handler.h"
17 #include "chromeos/network/network_profile_handler.h"
18 #include "chromeos/network/onc/onc_test_utils.h"
19 #include "chromeos/network/onc/onc_utils.h"
20 #include "dbus/object_path.h"
21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "third_party/cros_system_api/dbus/service_constants.h"
25 using ::testing::AnyNumber
;
26 using ::testing::Invoke
;
27 using ::testing::Mock
;
28 using ::testing::Pointee
;
29 using ::testing::Return
;
30 using ::testing::SaveArg
;
31 using ::testing::StrEq
;
32 using ::testing::StrictMock
;
35 namespace test_utils
= ::chromeos::onc::test_utils
;
41 std::string
ValueToString(const base::Value
* value
) {
42 std::stringstream str
;
47 const char kSharedProfilePath
[] = "/profile/default";
48 const char kUser1
[] = "user1";
49 const char kUser1ProfilePath
[] = "/profile/user1/shill";
51 // Matcher to match base::Value.
54 std::string(negation
? "isn't" : "is") + " equal to " +
55 ValueToString(value
)) {
56 return value
->Equals(&arg
);
59 class ShillProfileTestClient
{
61 typedef ShillClientHelper::DictionaryValueCallbackWithoutStatus
62 DictionaryValueCallbackWithoutStatus
;
63 typedef ShillClientHelper::ErrorCallback ErrorCallback
;
65 void AddProfile(const std::string
& profile_path
,
66 const std::string
& userhash
) {
67 if (profile_entries_
.HasKey(profile_path
))
70 base::DictionaryValue
* profile
= new base::DictionaryValue
;
71 profile_entries_
.SetWithoutPathExpansion(profile_path
, profile
);
72 profile_to_user_
[profile_path
] = userhash
;
75 void AddEntry(const std::string
& profile_path
,
76 const std::string
& entry_path
,
77 const base::DictionaryValue
& entry
) {
78 base::DictionaryValue
* entries
= NULL
;
79 profile_entries_
.GetDictionaryWithoutPathExpansion(profile_path
, &entries
);
82 base::DictionaryValue
* new_entry
= entry
.DeepCopy();
83 new_entry
->SetStringWithoutPathExpansion(shill::kProfileProperty
,
85 entries
->SetWithoutPathExpansion(entry_path
, new_entry
);
88 void GetProperties(const dbus::ObjectPath
& profile_path
,
89 const DictionaryValueCallbackWithoutStatus
& callback
,
90 const ErrorCallback
& error_callback
) {
91 base::DictionaryValue
* entries
= NULL
;
92 profile_entries_
.GetDictionaryWithoutPathExpansion(profile_path
.value(),
96 scoped_ptr
<base::DictionaryValue
> result(new base::DictionaryValue
);
97 base::ListValue
* entry_paths
= new base::ListValue
;
98 result
->SetWithoutPathExpansion(shill::kEntriesProperty
, entry_paths
);
99 for (base::DictionaryValue::Iterator
it(*entries
); !it
.IsAtEnd();
101 entry_paths
->AppendString(it
.key());
104 ASSERT_TRUE(ContainsKey(profile_to_user_
, profile_path
.value()));
105 const std::string
& userhash
= profile_to_user_
[profile_path
.value()];
106 result
->SetStringWithoutPathExpansion(shill::kUserHashProperty
, userhash
);
108 callback
.Run(*result
);
111 void GetEntry(const dbus::ObjectPath
& profile_path
,
112 const std::string
& entry_path
,
113 const DictionaryValueCallbackWithoutStatus
& callback
,
114 const ErrorCallback
& error_callback
) {
115 base::DictionaryValue
* entries
= NULL
;
116 profile_entries_
.GetDictionaryWithoutPathExpansion(profile_path
.value(),
118 ASSERT_TRUE(entries
);
120 base::DictionaryValue
* entry
= NULL
;
121 entries
->GetDictionaryWithoutPathExpansion(entry_path
, &entry
);
123 callback
.Run(*entry
);
127 base::DictionaryValue profile_entries_
;
128 std::map
<std::string
, std::string
> profile_to_user_
;
131 class TestNetworkProfileHandler
: public NetworkProfileHandler
{
133 TestNetworkProfileHandler() {
134 Init(NULL
/* No NetworkStateHandler */);
136 virtual ~TestNetworkProfileHandler() {}
138 void AddProfileForTest(const NetworkProfile
& profile
) {
143 DISALLOW_COPY_AND_ASSIGN(TestNetworkProfileHandler
);
148 class ManagedNetworkConfigurationHandlerTest
: public testing::Test
{
150 ManagedNetworkConfigurationHandlerTest()
151 : mock_manager_client_(NULL
),
152 mock_profile_client_(NULL
) {
155 virtual ~ManagedNetworkConfigurationHandlerTest() {
158 virtual void SetUp() OVERRIDE
{
159 FakeDBusThreadManager
* dbus_thread_manager
= new FakeDBusThreadManager
;
160 mock_manager_client_
= new StrictMock
<MockShillManagerClient
>();
161 mock_profile_client_
= new StrictMock
<MockShillProfileClient
>();
162 dbus_thread_manager
->SetShillManagerClient(
163 scoped_ptr
<ShillManagerClient
>(mock_manager_client_
).Pass());
164 dbus_thread_manager
->SetShillProfileClient(
165 scoped_ptr
<ShillProfileClient
>(mock_profile_client_
).Pass());
167 DBusThreadManager::InitializeForTesting(dbus_thread_manager
);
169 SetNetworkConfigurationHandlerExpectations();
171 ON_CALL(*mock_profile_client_
, GetProperties(_
,_
,_
))
172 .WillByDefault(Invoke(&profiles_stub_
,
173 &ShillProfileTestClient::GetProperties
));
175 ON_CALL(*mock_profile_client_
, GetEntry(_
,_
,_
,_
))
176 .WillByDefault(Invoke(&profiles_stub_
,
177 &ShillProfileTestClient::GetEntry
));
179 network_profile_handler_
.reset(new TestNetworkProfileHandler());
180 network_configuration_handler_
.reset(
181 NetworkConfigurationHandler::InitializeForTest(
182 NULL
/* no NetworkStateHandler */));
183 managed_network_configuration_handler_
.reset(
184 new ManagedNetworkConfigurationHandlerImpl());
185 managed_network_configuration_handler_
->Init(
186 NULL
/* no NetworkStateHandler */,
187 network_profile_handler_
.get(),
188 network_configuration_handler_
.get());
190 message_loop_
.RunUntilIdle();
193 virtual void TearDown() OVERRIDE
{
194 managed_network_configuration_handler_
.reset();
195 network_configuration_handler_
.reset();
196 network_profile_handler_
.reset();
197 DBusThreadManager::Shutdown();
200 void VerifyAndClearExpectations() {
201 Mock::VerifyAndClearExpectations(mock_manager_client_
);
202 Mock::VerifyAndClearExpectations(mock_profile_client_
);
203 SetNetworkConfigurationHandlerExpectations();
206 void InitializeStandardProfiles() {
207 profiles_stub_
.AddProfile(kUser1ProfilePath
, kUser1
);
208 network_profile_handler_
->
209 AddProfileForTest(NetworkProfile(kUser1ProfilePath
, kUser1
));
210 network_profile_handler_
->
211 AddProfileForTest(NetworkProfile(kSharedProfilePath
, std::string()));
214 void SetUpEntry(const std::string
& path_to_shill_json
,
215 const std::string
& profile_path
,
216 const std::string
& entry_path
) {
217 scoped_ptr
<base::DictionaryValue
> entry
=
218 test_utils::ReadTestDictionary(path_to_shill_json
);
219 profiles_stub_
.AddEntry(profile_path
, entry_path
, *entry
);
222 void SetPolicy(::onc::ONCSource onc_source
,
223 const std::string
& userhash
,
224 const std::string
& path_to_onc
) {
225 scoped_ptr
<base::DictionaryValue
> policy
;
226 if (path_to_onc
.empty())
227 policy
= onc::ReadDictionaryFromJson(onc::kEmptyUnencryptedConfiguration
);
229 policy
= test_utils::ReadTestDictionary(path_to_onc
);
231 base::ListValue empty_network_configs
;
232 base::ListValue
* network_configs
= &empty_network_configs
;
233 policy
->GetListWithoutPathExpansion(
234 ::onc::toplevel_config::kNetworkConfigurations
, &network_configs
);
236 base::DictionaryValue empty_global_config
;
237 base::DictionaryValue
* global_network_config
= &empty_global_config
;
238 policy
->GetDictionaryWithoutPathExpansion(
239 ::onc::toplevel_config::kGlobalNetworkConfiguration
,
240 &global_network_config
);
242 managed_handler()->SetPolicy(
243 onc_source
, userhash
, *network_configs
, *global_network_config
);
246 void SetNetworkConfigurationHandlerExpectations() {
247 // These calls occur in NetworkConfigurationHandler.
248 EXPECT_CALL(*mock_manager_client_
, GetProperties(_
)).Times(AnyNumber());
249 EXPECT_CALL(*mock_manager_client_
,
250 AddPropertyChangedObserver(_
)).Times(AnyNumber());
251 EXPECT_CALL(*mock_manager_client_
,
252 RemovePropertyChangedObserver(_
)).Times(AnyNumber());
255 ManagedNetworkConfigurationHandler
* managed_handler() {
256 return managed_network_configuration_handler_
.get();
260 MockShillManagerClient
* mock_manager_client_
;
261 MockShillProfileClient
* mock_profile_client_
;
262 ShillProfileTestClient profiles_stub_
;
263 scoped_ptr
<TestNetworkProfileHandler
> network_profile_handler_
;
264 scoped_ptr
<NetworkConfigurationHandler
> network_configuration_handler_
;
265 scoped_ptr
<ManagedNetworkConfigurationHandlerImpl
>
266 managed_network_configuration_handler_
;
267 base::MessageLoop message_loop_
;
270 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandlerTest
);
273 TEST_F(ManagedNetworkConfigurationHandlerTest
, ProfileInitialization
) {
274 InitializeStandardProfiles();
275 message_loop_
.RunUntilIdle();
278 TEST_F(ManagedNetworkConfigurationHandlerTest
, RemoveIrrelevantFields
) {
279 InitializeStandardProfiles();
280 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
281 test_utils::ReadTestDictionary(
282 "policy/shill_policy_on_unconfigured_wifi1.json");
284 EXPECT_CALL(*mock_profile_client_
,
285 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
287 EXPECT_CALL(*mock_manager_client_
,
288 ConfigureServiceForProfile(
289 dbus::ObjectPath(kUser1ProfilePath
),
290 IsEqualTo(expected_shill_properties
.get()),
293 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
,
295 "policy/policy_wifi1_with_redundant_fields.onc");
296 message_loop_
.RunUntilIdle();
299 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyManageUnconfigured
) {
300 InitializeStandardProfiles();
301 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
302 test_utils::ReadTestDictionary(
303 "policy/shill_policy_on_unconfigured_wifi1.json");
305 EXPECT_CALL(*mock_profile_client_
,
306 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
308 EXPECT_CALL(*mock_manager_client_
,
309 ConfigureServiceForProfile(
310 dbus::ObjectPath(kUser1ProfilePath
),
311 IsEqualTo(expected_shill_properties
.get()),
314 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
315 message_loop_
.RunUntilIdle();
318 // Ensure that EAP settings for ethernet are matched with the right profile
319 // entry and written to the dedicated EthernetEAP service.
320 TEST_F(ManagedNetworkConfigurationHandlerTest
,
321 SetPolicyManageUnmanagedEthernetEAP
) {
322 InitializeStandardProfiles();
323 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
324 test_utils::ReadTestDictionary(
326 "shill_policy_on_unmanaged_ethernet_eap.json");
328 SetUpEntry("policy/shill_unmanaged_ethernet_eap.json",
332 // Also setup an unrelated WiFi configuration to verify that the right entry
334 SetUpEntry("policy/shill_unmanaged_wifi1.json",
338 EXPECT_CALL(*mock_profile_client_
,
339 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
341 EXPECT_CALL(*mock_profile_client_
,
342 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), _
, _
, _
)).Times(2);
345 *mock_profile_client_
,
346 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath
), "eth_entry", _
, _
));
349 *mock_manager_client_
,
350 ConfigureServiceForProfile(dbus::ObjectPath(kUser1ProfilePath
),
351 IsEqualTo(expected_shill_properties
.get()),
355 ::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_ethernet_eap.onc");
356 message_loop_
.RunUntilIdle();
359 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyIgnoreUnmodified
) {
360 InitializeStandardProfiles();
361 EXPECT_CALL(*mock_profile_client_
, GetProperties(_
, _
, _
));
363 EXPECT_CALL(*mock_manager_client_
, ConfigureServiceForProfile(_
, _
, _
, _
));
365 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
366 message_loop_
.RunUntilIdle();
367 VerifyAndClearExpectations();
369 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json",
373 EXPECT_CALL(*mock_profile_client_
, GetProperties(_
, _
, _
));
376 *mock_profile_client_
,
377 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "some_entry_path", _
, _
));
379 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
380 message_loop_
.RunUntilIdle();
383 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyManageUnmanaged
) {
384 InitializeStandardProfiles();
385 SetUpEntry("policy/shill_unmanaged_wifi1.json",
389 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
390 test_utils::ReadTestDictionary(
391 "policy/shill_policy_on_unmanaged_wifi1.json");
393 EXPECT_CALL(*mock_profile_client_
,
394 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
397 *mock_profile_client_
,
398 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
401 *mock_profile_client_
,
402 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
404 EXPECT_CALL(*mock_manager_client_
,
405 ConfigureServiceForProfile(
406 dbus::ObjectPath(kUser1ProfilePath
),
407 IsEqualTo(expected_shill_properties
.get()),
410 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
411 message_loop_
.RunUntilIdle();
414 // Old ChromeOS versions may not have used the UIData property
415 TEST_F(ManagedNetworkConfigurationHandlerTest
,
416 SetPolicyManageUnmanagedWithoutUIData
) {
417 InitializeStandardProfiles();
418 SetUpEntry("policy/shill_unmanaged_wifi1.json",
422 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
423 test_utils::ReadTestDictionary(
424 "policy/shill_policy_on_unmanaged_wifi1.json");
426 EXPECT_CALL(*mock_profile_client_
,
427 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
430 *mock_profile_client_
,
431 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
434 *mock_profile_client_
,
435 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
437 EXPECT_CALL(*mock_manager_client_
,
438 ConfigureServiceForProfile(
439 dbus::ObjectPath(kUser1ProfilePath
),
440 IsEqualTo(expected_shill_properties
.get()),
443 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
444 message_loop_
.RunUntilIdle();
447 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyUpdateManagedNewGUID
) {
448 InitializeStandardProfiles();
449 SetUpEntry("policy/shill_managed_wifi1.json",
453 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
454 test_utils::ReadTestDictionary(
455 "policy/shill_policy_on_unmanaged_wifi1.json");
457 // The passphrase isn't sent again, because it's configured by the user and
458 // Shill doesn't sent it on GetProperties calls.
459 expected_shill_properties
->RemoveWithoutPathExpansion(
460 shill::kPassphraseProperty
, NULL
);
462 EXPECT_CALL(*mock_profile_client_
,
463 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
466 *mock_profile_client_
,
467 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
470 *mock_profile_client_
,
471 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
473 EXPECT_CALL(*mock_manager_client_
,
474 ConfigureServiceForProfile(
475 dbus::ObjectPath(kUser1ProfilePath
),
476 IsEqualTo(expected_shill_properties
.get()),
479 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
480 message_loop_
.RunUntilIdle();
483 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyReapplyToManaged
) {
484 InitializeStandardProfiles();
485 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json",
489 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
490 test_utils::ReadTestDictionary(
491 "policy/shill_policy_on_unmanaged_wifi1.json");
493 // The passphrase isn't sent again, because it's configured by the user and
494 // Shill doesn't sent it on GetProperties calls.
495 expected_shill_properties
->RemoveWithoutPathExpansion(
496 shill::kPassphraseProperty
, NULL
);
498 EXPECT_CALL(*mock_profile_client_
,
499 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
502 *mock_profile_client_
,
503 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
505 EXPECT_CALL(*mock_manager_client_
,
506 ConfigureServiceForProfile(
507 dbus::ObjectPath(kUser1ProfilePath
),
508 IsEqualTo(expected_shill_properties
.get()),
511 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
512 message_loop_
.RunUntilIdle();
513 VerifyAndClearExpectations();
515 // If we apply the policy again, without change, then the Shill profile will
517 EXPECT_CALL(*mock_profile_client_
,
518 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
521 *mock_profile_client_
,
522 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "old_entry_path", _
, _
));
524 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
525 message_loop_
.RunUntilIdle();
528 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyUnmanageManaged
) {
529 InitializeStandardProfiles();
530 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json",
534 EXPECT_CALL(*mock_profile_client_
,
535 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
537 EXPECT_CALL(*mock_profile_client_
,
538 GetEntry(dbus::ObjectPath(kUser1ProfilePath
),
542 EXPECT_CALL(*mock_profile_client_
,
543 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath
),
547 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "");
548 message_loop_
.RunUntilIdle();
551 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetEmptyPolicyIgnoreUnmanaged
) {
552 InitializeStandardProfiles();
553 SetUpEntry("policy/shill_unmanaged_wifi1.json",
557 EXPECT_CALL(*mock_profile_client_
,
558 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
560 EXPECT_CALL(*mock_profile_client_
,
561 GetEntry(dbus::ObjectPath(kUser1ProfilePath
),
565 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "");
566 message_loop_
.RunUntilIdle();
569 TEST_F(ManagedNetworkConfigurationHandlerTest
, SetPolicyIgnoreUnmanaged
) {
570 InitializeStandardProfiles();
571 SetUpEntry("policy/shill_unmanaged_wifi2.json",
575 EXPECT_CALL(*mock_profile_client_
,
576 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
579 *mock_profile_client_
,
580 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "wifi2_entry_path", _
, _
));
582 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
583 test_utils::ReadTestDictionary(
584 "policy/shill_policy_on_unconfigured_wifi1.json");
586 EXPECT_CALL(*mock_manager_client_
,
587 ConfigureServiceForProfile(
588 dbus::ObjectPath(kUser1ProfilePath
),
589 IsEqualTo(expected_shill_properties
.get()),
592 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
593 message_loop_
.RunUntilIdle();
596 TEST_F(ManagedNetworkConfigurationHandlerTest
, AutoConnectDisallowed
) {
597 InitializeStandardProfiles();
598 SetUpEntry("policy/shill_unmanaged_wifi2.json",
602 EXPECT_CALL(*mock_profile_client_
,
603 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
606 *mock_profile_client_
,
607 GetEntry(dbus::ObjectPath(kUser1ProfilePath
), "wifi2_entry_path", _
, _
));
609 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
610 test_utils::ReadTestDictionary(
611 "policy/shill_disallow_autoconnect_on_unmanaged_wifi2.json");
613 EXPECT_CALL(*mock_manager_client_
,
614 ConfigureServiceForProfile(
615 dbus::ObjectPath(kUser1ProfilePath
),
616 IsEqualTo(expected_shill_properties
.get()),
619 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
,
621 "policy/policy_disallow_autoconnect.onc");
622 message_loop_
.RunUntilIdle();
625 TEST_F(ManagedNetworkConfigurationHandlerTest
, LateProfileLoading
) {
626 SetPolicy(::onc::ONC_SOURCE_USER_POLICY
, kUser1
, "policy/policy_wifi1.onc");
628 message_loop_
.RunUntilIdle();
629 VerifyAndClearExpectations();
631 scoped_ptr
<base::DictionaryValue
> expected_shill_properties
=
632 test_utils::ReadTestDictionary(
633 "policy/shill_policy_on_unconfigured_wifi1.json");
635 EXPECT_CALL(*mock_profile_client_
,
636 GetProperties(dbus::ObjectPath(kUser1ProfilePath
), _
, _
));
638 EXPECT_CALL(*mock_manager_client_
,
639 ConfigureServiceForProfile(
640 dbus::ObjectPath(kUser1ProfilePath
),
641 IsEqualTo(expected_shill_properties
.get()),
644 InitializeStandardProfiles();
645 message_loop_
.RunUntilIdle();
648 } // namespace chromeos