Chromium Code Reviews| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
| 10 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 10 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 EXPECT_CALL(mock_manager_client_, | 303 EXPECT_CALL(mock_manager_client_, |
| 304 ConfigureServiceForProfile( | 304 ConfigureServiceForProfile( |
| 305 dbus::ObjectPath(kUser1ProfilePath), | 305 dbus::ObjectPath(kUser1ProfilePath), |
| 306 IsEqualTo(expected_shill_properties.get()), | 306 IsEqualTo(expected_shill_properties.get()), |
| 307 _, _)); | 307 _, _)); |
| 308 | 308 |
| 309 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 309 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
| 310 message_loop_.RunUntilIdle(); | 310 message_loop_.RunUntilIdle(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 // Ensure that EAP settings for ethernet are matched with the right profile | |
| 314 // entry and written to the dedicated EthernetEAP service. | |
| 315 TEST_F(ManagedNetworkConfigurationHandlerTest, | |
| 316 SetPolicyManageUnmanagedEthernetEAP) { | |
| 317 InitializeStandardProfiles(); | |
| 318 scoped_ptr<base::DictionaryValue> expected_shill_properties = | |
|
bartfab (slow)
2013/09/17 08:45:54
Nit: #include "base/memory/scoped_ptr.h"
pneubeck (no reviews)
2013/09/17 12:48:36
Done.
| |
| 319 test_utils::ReadTestDictionary( | |
| 320 "policy/" | |
| 321 "shill_policy_on_unmanaged_ethernet_eap.json"); | |
| 322 | |
| 323 SetUpEntry("policy/shill_unmanaged_ethernet_eap.json", | |
| 324 kUser1ProfilePath, | |
| 325 "eth_entry"); | |
| 326 | |
| 327 // Also setup an unrelated WiFi configuration to verify that the right entry | |
| 328 // is matched. | |
| 329 SetUpEntry("policy/shill_unmanaged_user_wifi1.json", | |
| 330 kUser1ProfilePath, | |
| 331 "wifi_entry"); | |
| 332 | |
| 333 EXPECT_CALL(mock_profile_client_, | |
| 334 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); | |
| 335 | |
| 336 EXPECT_CALL(mock_profile_client_, | |
| 337 GetEntry(dbus::ObjectPath(kUser1ProfilePath), _, _, _)).Times(2); | |
| 338 | |
| 339 EXPECT_CALL( | |
| 340 mock_profile_client_, | |
| 341 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath), "eth_entry", _, _)); | |
| 342 | |
| 343 EXPECT_CALL( | |
| 344 mock_manager_client_, | |
| 345 ConfigureServiceForProfile(dbus::ObjectPath(kUser1ProfilePath), | |
| 346 IsEqualTo(expected_shill_properties.get()), | |
| 347 _, _)); | |
| 348 | |
| 349 SetPolicy( | |
| 350 onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_ethernet_eap.onc"); | |
| 351 message_loop_.RunUntilIdle(); | |
| 352 } | |
| 353 | |
| 313 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) { | 354 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) { |
| 314 InitializeStandardProfiles(); | 355 InitializeStandardProfiles(); |
| 315 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); | 356 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); |
| 316 | 357 |
| 317 EXPECT_CALL(mock_manager_client_, ConfigureServiceForProfile(_, _, _, _)); | 358 EXPECT_CALL(mock_manager_client_, ConfigureServiceForProfile(_, _, _, _)); |
| 318 | 359 |
| 319 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 360 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
| 320 message_loop_.RunUntilIdle(); | 361 message_loop_.RunUntilIdle(); |
| 321 VerifyAndClearExpectations(); | 362 VerifyAndClearExpectations(); |
| 322 | 363 |
| 323 SetUpEntry("policy/shill_policy_on_unmanaged_user_wifi1.json", | 364 SetUpEntry("policy/shill_policy_on_unmanaged_user_wifi1.json", |
| 324 kUser1ProfilePath, | 365 kUser1ProfilePath, |
| 325 "some_entry_path"); | 366 "some_entry_path"); |
| 326 | 367 |
| 327 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); | 368 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); |
| 328 | 369 |
| 329 EXPECT_CALL(mock_profile_client_, | 370 EXPECT_CALL( |
| 330 GetEntry(dbus::ObjectPath(kUser1ProfilePath), | 371 mock_profile_client_, |
| 331 "some_entry_path", | 372 GetEntry(dbus::ObjectPath(kUser1ProfilePath), "some_entry_path", _, _)); |
| 332 _, _)); | |
| 333 | 373 |
| 334 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); | 374 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); |
| 335 message_loop_.RunUntilIdle(); | 375 message_loop_.RunUntilIdle(); |
| 336 } | 376 } |
| 337 | 377 |
| 338 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnmanaged) { | 378 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnmanaged) { |
| 339 InitializeStandardProfiles(); | 379 InitializeStandardProfiles(); |
| 340 SetUpEntry("policy/shill_unmanaged_user_wifi1.json", | 380 SetUpEntry("policy/shill_unmanaged_user_wifi1.json", |
| 341 kUser1ProfilePath, | 381 kUser1ProfilePath, |
| 342 "old_entry_path"); | 382 "old_entry_path"); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 ConfigureServiceForProfile( | 605 ConfigureServiceForProfile( |
| 566 dbus::ObjectPath(kUser1ProfilePath), | 606 dbus::ObjectPath(kUser1ProfilePath), |
| 567 IsEqualTo(expected_shill_properties.get()), | 607 IsEqualTo(expected_shill_properties.get()), |
| 568 _, _)); | 608 _, _)); |
| 569 | 609 |
| 570 InitializeStandardProfiles(); | 610 InitializeStandardProfiles(); |
| 571 message_loop_.RunUntilIdle(); | 611 message_loop_.RunUntilIdle(); |
| 572 } | 612 } |
| 573 | 613 |
| 574 } // namespace chromeos | 614 } // namespace chromeos |
| OLD | NEW |