Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: chromeos/network/managed_network_configuration_handler_unittest.cc

Issue 23451044: Add an Ethernet EAP policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on NetworkStateBase removal and addressed comments. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 10 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chromeos/dbus/mock_dbus_thread_manager.h" 11 #include "chromeos/dbus/mock_dbus_thread_manager.h"
11 #include "chromeos/dbus/mock_shill_manager_client.h" 12 #include "chromeos/dbus/mock_shill_manager_client.h"
12 #include "chromeos/dbus/mock_shill_profile_client.h" 13 #include "chromeos/dbus/mock_shill_profile_client.h"
13 #include "chromeos/dbus/mock_shill_service_client.h" 14 #include "chromeos/dbus/mock_shill_service_client.h"
14 #include "chromeos/network/managed_network_configuration_handler_impl.h" 15 #include "chromeos/network/managed_network_configuration_handler_impl.h"
15 #include "chromeos/network/network_configuration_handler.h" 16 #include "chromeos/network/network_configuration_handler.h"
16 #include "chromeos/network/network_profile_handler.h" 17 #include "chromeos/network/network_profile_handler.h"
17 #include "chromeos/network/onc/onc_test_utils.h" 18 #include "chromeos/network/onc/onc_test_utils.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 EXPECT_CALL(mock_manager_client_, 304 EXPECT_CALL(mock_manager_client_,
304 ConfigureServiceForProfile( 305 ConfigureServiceForProfile(
305 dbus::ObjectPath(kUser1ProfilePath), 306 dbus::ObjectPath(kUser1ProfilePath),
306 IsEqualTo(expected_shill_properties.get()), 307 IsEqualTo(expected_shill_properties.get()),
307 _, _)); 308 _, _));
308 309
309 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 310 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
310 message_loop_.RunUntilIdle(); 311 message_loop_.RunUntilIdle();
311 } 312 }
312 313
314 // Ensure that EAP settings for ethernet are matched with the right profile
315 // entry and written to the dedicated EthernetEAP service.
316 TEST_F(ManagedNetworkConfigurationHandlerTest,
317 SetPolicyManageUnmanagedEthernetEAP) {
318 InitializeStandardProfiles();
319 scoped_ptr<base::DictionaryValue> expected_shill_properties =
320 test_utils::ReadTestDictionary(
321 "policy/"
322 "shill_policy_on_unmanaged_ethernet_eap.json");
323
324 SetUpEntry("policy/shill_unmanaged_ethernet_eap.json",
325 kUser1ProfilePath,
326 "eth_entry");
327
328 // Also setup an unrelated WiFi configuration to verify that the right entry
329 // is matched.
330 SetUpEntry("policy/shill_unmanaged_user_wifi1.json",
331 kUser1ProfilePath,
332 "wifi_entry");
333
334 EXPECT_CALL(mock_profile_client_,
335 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _));
336
337 EXPECT_CALL(mock_profile_client_,
338 GetEntry(dbus::ObjectPath(kUser1ProfilePath), _, _, _)).Times(2);
339
340 EXPECT_CALL(
341 mock_profile_client_,
342 DeleteEntry(dbus::ObjectPath(kUser1ProfilePath), "eth_entry", _, _));
343
344 EXPECT_CALL(
345 mock_manager_client_,
346 ConfigureServiceForProfile(dbus::ObjectPath(kUser1ProfilePath),
347 IsEqualTo(expected_shill_properties.get()),
348 _, _));
349
350 SetPolicy(
351 onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_ethernet_eap.onc");
352 message_loop_.RunUntilIdle();
353 }
354
313 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) { 355 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyIgnoreUnmodified) {
314 InitializeStandardProfiles(); 356 InitializeStandardProfiles();
315 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); 357 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _));
316 358
317 EXPECT_CALL(mock_manager_client_, ConfigureServiceForProfile(_, _, _, _)); 359 EXPECT_CALL(mock_manager_client_, ConfigureServiceForProfile(_, _, _, _));
318 360
319 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 361 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
320 message_loop_.RunUntilIdle(); 362 message_loop_.RunUntilIdle();
321 VerifyAndClearExpectations(); 363 VerifyAndClearExpectations();
322 364
323 SetUpEntry("policy/shill_policy_on_unmanaged_user_wifi1.json", 365 SetUpEntry("policy/shill_policy_on_unmanaged_user_wifi1.json",
324 kUser1ProfilePath, 366 kUser1ProfilePath,
325 "some_entry_path"); 367 "some_entry_path");
326 368
327 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _)); 369 EXPECT_CALL(mock_profile_client_, GetProperties(_, _, _));
328 370
329 EXPECT_CALL(mock_profile_client_, 371 EXPECT_CALL(
330 GetEntry(dbus::ObjectPath(kUser1ProfilePath), 372 mock_profile_client_,
331 "some_entry_path", 373 GetEntry(dbus::ObjectPath(kUser1ProfilePath), "some_entry_path", _, _));
332 _, _));
333 374
334 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 375 SetPolicy(onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
335 message_loop_.RunUntilIdle(); 376 message_loop_.RunUntilIdle();
336 } 377 }
337 378
338 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnmanaged) { 379 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyManageUnmanaged) {
339 InitializeStandardProfiles(); 380 InitializeStandardProfiles();
340 SetUpEntry("policy/shill_unmanaged_user_wifi1.json", 381 SetUpEntry("policy/shill_unmanaged_user_wifi1.json",
341 kUser1ProfilePath, 382 kUser1ProfilePath,
342 "old_entry_path"); 383 "old_entry_path");
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 ConfigureServiceForProfile( 606 ConfigureServiceForProfile(
566 dbus::ObjectPath(kUser1ProfilePath), 607 dbus::ObjectPath(kUser1ProfilePath),
567 IsEqualTo(expected_shill_properties.get()), 608 IsEqualTo(expected_shill_properties.get()),
568 _, _)); 609 _, _));
569 610
570 InitializeStandardProfiles(); 611 InitializeStandardProfiles();
571 message_loop_.RunUntilIdle(); 612 message_loop_.RunUntilIdle();
572 } 613 }
573 614
574 } // namespace chromeos 615 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698