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

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

Issue 2810703005: Fix policy_util iterator and re-enable networking tests (Closed)
Patch Set: Created 3 years, 8 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
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 <memory> 6 #include <memory>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 EXPECT_CALL( 542 EXPECT_CALL(
543 *mock_profile_client_, 543 *mock_profile_client_,
544 GetEntry(dbus::ObjectPath(kUser1ProfilePath), "some_entry_path", _, _)); 544 GetEntry(dbus::ObjectPath(kUser1ProfilePath), "some_entry_path", _, _));
545 545
546 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 546 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
547 547
548 base::RunLoop().RunUntilIdle(); 548 base::RunLoop().RunUntilIdle();
549 EXPECT_EQ(1, policy_observer_.GetPoliciesAppliedCountAndReset()); 549 EXPECT_EQ(1, policy_observer_.GetPoliciesAppliedCountAndReset());
550 } 550 }
551 551
552 // TODO(stevenjb): https://crbug.com/710241 552 TEST_F(ManagedNetworkConfigurationHandlerTest, PolicyApplicationRunning) {
553 TEST_F(ManagedNetworkConfigurationHandlerTest,
554 DISABLED_PolicyApplicationRunning) {
555 InitializeStandardProfiles(); 553 InitializeStandardProfiles();
556 EXPECT_CALL(*mock_profile_client_, GetProperties(_, _, _)).Times(AnyNumber()); 554 EXPECT_CALL(*mock_profile_client_, GetProperties(_, _, _)).Times(AnyNumber());
557 EXPECT_CALL(*mock_manager_client_, ConfigureServiceForProfile(_, _, _, _)) 555 EXPECT_CALL(*mock_manager_client_, ConfigureServiceForProfile(_, _, _, _))
558 .Times(AnyNumber()); 556 .Times(AnyNumber());
559 EXPECT_CALL(*mock_profile_client_, GetEntry(_, _, _, _)).Times(AnyNumber()); 557 EXPECT_CALL(*mock_profile_client_, GetEntry(_, _, _, _)).Times(AnyNumber());
560 558
561 EXPECT_FALSE(managed_handler()->IsAnyPolicyApplicationRunning()); 559 EXPECT_FALSE(managed_handler()->IsAnyPolicyApplicationRunning());
562 560
563 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 561 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
564 managed_handler()->SetPolicy( 562 managed_handler()->SetPolicy(
(...skipping 10 matching lines...) Expand all
575 kUser1ProfilePath, 573 kUser1ProfilePath,
576 "some_entry_path"); 574 "some_entry_path");
577 575
578 SetPolicy( 576 SetPolicy(
579 ::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1_update.onc"); 577 ::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1_update.onc");
580 EXPECT_TRUE(managed_handler()->IsAnyPolicyApplicationRunning()); 578 EXPECT_TRUE(managed_handler()->IsAnyPolicyApplicationRunning());
581 base::RunLoop().RunUntilIdle(); 579 base::RunLoop().RunUntilIdle();
582 EXPECT_FALSE(managed_handler()->IsAnyPolicyApplicationRunning()); 580 EXPECT_FALSE(managed_handler()->IsAnyPolicyApplicationRunning());
583 } 581 }
584 582
585 // TODO(stevenjb): https://crbug.com/710241 583 TEST_F(ManagedNetworkConfigurationHandlerTest, UpdatePolicyAfterFinished) {
586 TEST_F(ManagedNetworkConfigurationHandlerTest,
587 DISABLED_UpdatePolicyAfterFinished) {
588 InitializeStandardProfiles(); 584 InitializeStandardProfiles();
589 EXPECT_CALL(*mock_profile_client_, GetProperties(_, _, _)); 585 EXPECT_CALL(*mock_profile_client_, GetProperties(_, _, _));
590 EXPECT_CALL(*mock_manager_client_, ConfigureServiceForProfile(_, _, _, _)); 586 EXPECT_CALL(*mock_manager_client_, ConfigureServiceForProfile(_, _, _, _));
591 587
592 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 588 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
593 base::RunLoop().RunUntilIdle(); 589 base::RunLoop().RunUntilIdle();
594 EXPECT_EQ(1, policy_observer_.GetPoliciesAppliedCountAndReset()); 590 EXPECT_EQ(1, policy_observer_.GetPoliciesAppliedCountAndReset());
595 VerifyAndClearExpectations(); 591 VerifyAndClearExpectations();
596 592
597 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json", 593 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json",
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 EXPECT_CALL(*mock_manager_client_, 679 EXPECT_CALL(*mock_manager_client_,
684 ConfigureServiceForProfile( 680 ConfigureServiceForProfile(
685 dbus::ObjectPath(kUser1ProfilePath), 681 dbus::ObjectPath(kUser1ProfilePath),
686 IsEqualTo(expected_shill_properties.get()), 682 IsEqualTo(expected_shill_properties.get()),
687 _, _)); 683 _, _));
688 684
689 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 685 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
690 base::RunLoop().RunUntilIdle(); 686 base::RunLoop().RunUntilIdle();
691 } 687 }
692 688
693 // TODO(stevenjb): https://crbug.com/710241 689 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyUpdateManagedNewGUID) {
694 TEST_F(ManagedNetworkConfigurationHandlerTest,
695 DISABLED_SetPolicyUpdateManagedNewGUID) {
696 InitializeStandardProfiles(); 690 InitializeStandardProfiles();
697 SetUpEntry("policy/shill_managed_wifi1.json", 691 SetUpEntry("policy/shill_managed_wifi1.json",
698 kUser1ProfilePath, 692 kUser1ProfilePath,
699 "old_entry_path"); 693 "old_entry_path");
700 694
701 std::unique_ptr<base::DictionaryValue> expected_shill_properties = 695 std::unique_ptr<base::DictionaryValue> expected_shill_properties =
702 test_utils::ReadTestDictionary( 696 test_utils::ReadTestDictionary(
703 "policy/shill_policy_on_unmanaged_wifi1.json"); 697 "policy/shill_policy_on_unmanaged_wifi1.json");
704 698
705 // The passphrase isn't sent again, because it's configured by the user and 699 // The passphrase isn't sent again, because it's configured by the user and
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 ConfigureServiceForProfile( 740 ConfigureServiceForProfile(
747 dbus::ObjectPath(kUser1ProfilePath), 741 dbus::ObjectPath(kUser1ProfilePath),
748 IsEqualTo(expected_shill_properties.get()), 742 IsEqualTo(expected_shill_properties.get()),
749 _, _)); 743 _, _));
750 744
751 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_vpn.onc"); 745 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_vpn.onc");
752 base::RunLoop().RunUntilIdle(); 746 base::RunLoop().RunUntilIdle();
753 VerifyAndClearExpectations(); 747 VerifyAndClearExpectations();
754 } 748 }
755 749
756 // TODO(stevenjb): https://crbug.com/710241 750 TEST_F(ManagedNetworkConfigurationHandlerTest, SetPolicyReapplyToManaged) {
757 TEST_F(ManagedNetworkConfigurationHandlerTest,
758 DISABLED_SetPolicyReapplyToManaged) {
759 InitializeStandardProfiles(); 751 InitializeStandardProfiles();
760 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json", 752 SetUpEntry("policy/shill_policy_on_unmanaged_wifi1.json",
761 kUser1ProfilePath, 753 kUser1ProfilePath,
762 "old_entry_path"); 754 "old_entry_path");
763 755
764 std::unique_ptr<base::DictionaryValue> expected_shill_properties = 756 std::unique_ptr<base::DictionaryValue> expected_shill_properties =
765 test_utils::ReadTestDictionary( 757 test_utils::ReadTestDictionary(
766 "policy/shill_policy_on_unmanaged_wifi1.json"); 758 "policy/shill_policy_on_unmanaged_wifi1.json");
767 759
768 // The passphrase isn't sent again, because it's configured by the user and 760 // The passphrase isn't sent again, because it's configured by the user and
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 EXPECT_CALL(*mock_profile_client_, 979 EXPECT_CALL(*mock_profile_client_,
988 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _)); 980 GetProperties(dbus::ObjectPath(kUser1ProfilePath), _, _));
989 981
990 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc"); 982 SetPolicy(::onc::ONC_SOURCE_USER_POLICY, kUser1, "policy/policy_wifi1.onc");
991 managed_network_configuration_handler_->RemoveObserver(&policy_observer_); 983 managed_network_configuration_handler_->RemoveObserver(&policy_observer_);
992 managed_network_configuration_handler_.reset(); 984 managed_network_configuration_handler_.reset();
993 base::RunLoop().RunUntilIdle(); 985 base::RunLoop().RunUntilIdle();
994 } 986 }
995 987
996 } // namespace chromeos 988 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698