| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/policy/profile_policy_connector.h" | 5 #include "chrome/browser/policy/profile_policy_connector.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | |
| 8 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 8 #include "base/values.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" | 9 #include "chrome/test/base/testing_browser_process.h" |
| 11 #include "components/autofill/core/common/autofill_pref_names.h" | 10 #include "components/autofill/core/common/autofill_pref_names.h" |
| 12 #include "components/policy/core/browser/browser_policy_connector.h" | 11 #include "components/policy/core/browser/browser_policy_connector.h" |
| 13 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 12 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 14 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 13 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 15 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 14 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
| 16 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 15 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 17 #include "components/policy/core/common/policy_bundle.h" | 16 #include "components/policy/core/common/policy_bundle.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 ~ProfilePolicyConnectorTest() override {} | 32 ~ProfilePolicyConnectorTest() override {} |
| 34 | 33 |
| 35 void SetUp() override { | 34 void SetUp() override { |
| 36 // This must be set up before the TestingBrowserProcess is created. | 35 // This must be set up before the TestingBrowserProcess is created. |
| 37 BrowserPolicyConnector::SetPolicyProviderForTesting(&mock_provider_); | 36 BrowserPolicyConnector::SetPolicyProviderForTesting(&mock_provider_); |
| 38 | 37 |
| 39 EXPECT_CALL(mock_provider_, IsInitializationComplete(_)) | 38 EXPECT_CALL(mock_provider_, IsInitializationComplete(_)) |
| 40 .WillRepeatedly(Return(true)); | 39 .WillRepeatedly(Return(true)); |
| 41 | 40 |
| 42 cloud_policy_store_.NotifyStoreLoaded(); | 41 cloud_policy_store_.NotifyStoreLoaded(); |
| 43 cloud_policy_manager_.reset( | 42 cloud_policy_manager_.reset(new CloudPolicyManager( |
| 44 new CloudPolicyManager(std::string(), | 43 std::string(), std::string(), &cloud_policy_store_, loop_.task_runner(), |
| 45 std::string(), | 44 loop_.task_runner(), loop_.task_runner())); |
| 46 &cloud_policy_store_, | |
| 47 loop_.message_loop_proxy(), | |
| 48 loop_.message_loop_proxy(), | |
| 49 loop_.message_loop_proxy())); | |
| 50 } | 45 } |
| 51 | 46 |
| 52 void TearDown() override { | 47 void TearDown() override { |
| 53 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(nullptr); | 48 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(nullptr); |
| 54 cloud_policy_manager_->Shutdown(); | 49 cloud_policy_manager_->Shutdown(); |
| 55 } | 50 } |
| 56 | 51 |
| 57 base::MessageLoop loop_; | 52 base::MessageLoop loop_; |
| 58 SchemaRegistry schema_registry_; | 53 SchemaRegistry schema_registry_; |
| 59 MockConfigurationPolicyProvider mock_provider_; | 54 MockConfigurationPolicyProvider mock_provider_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue( | 99 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue( |
| 105 key::kAutoFillEnabled); | 100 key::kAutoFillEnabled); |
| 106 ASSERT_TRUE(value); | 101 ASSERT_TRUE(value); |
| 107 EXPECT_TRUE(base::FundamentalValue(true).Equals(value)); | 102 EXPECT_TRUE(base::FundamentalValue(true).Equals(value)); |
| 108 | 103 |
| 109 // Cleanup. | 104 // Cleanup. |
| 110 connector.Shutdown(); | 105 connector.Shutdown(); |
| 111 } | 106 } |
| 112 | 107 |
| 113 } // namespace policy | 108 } // namespace policy |
| OLD | NEW |