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