| 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" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 using testing::Return; | 25 using testing::Return; |
| 26 using testing::_; | 26 using testing::_; |
| 27 | 27 |
| 28 namespace policy { | 28 namespace policy { |
| 29 | 29 |
| 30 class ProfilePolicyConnectorTest : public testing::Test { | 30 class ProfilePolicyConnectorTest : public testing::Test { |
| 31 protected: | 31 protected: |
| 32 ProfilePolicyConnectorTest() {} | 32 ProfilePolicyConnectorTest() {} |
| 33 virtual ~ProfilePolicyConnectorTest() {} | 33 ~ProfilePolicyConnectorTest() override {} |
| 34 | 34 |
| 35 virtual void SetUp() override { | 35 void SetUp() override { |
| 36 // This must be set up before the TestingBrowserProcess is created. | 36 // This must be set up before the TestingBrowserProcess is created. |
| 37 BrowserPolicyConnector::SetPolicyProviderForTesting(&mock_provider_); | 37 BrowserPolicyConnector::SetPolicyProviderForTesting(&mock_provider_); |
| 38 | 38 |
| 39 EXPECT_CALL(mock_provider_, IsInitializationComplete(_)) | 39 EXPECT_CALL(mock_provider_, IsInitializationComplete(_)) |
| 40 .WillRepeatedly(Return(true)); | 40 .WillRepeatedly(Return(true)); |
| 41 | 41 |
| 42 cloud_policy_store_.NotifyStoreLoaded(); | 42 cloud_policy_store_.NotifyStoreLoaded(); |
| 43 cloud_policy_manager_.reset( | 43 cloud_policy_manager_.reset( |
| 44 new CloudPolicyManager(PolicyNamespaceKey("", ""), | 44 new CloudPolicyManager(PolicyNamespaceKey("", ""), |
| 45 &cloud_policy_store_, | 45 &cloud_policy_store_, |
| 46 loop_.message_loop_proxy(), | 46 loop_.message_loop_proxy(), |
| 47 loop_.message_loop_proxy(), | 47 loop_.message_loop_proxy(), |
| 48 loop_.message_loop_proxy())); | 48 loop_.message_loop_proxy())); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void TearDown() { | 51 void TearDown() override { |
| 52 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); | 52 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); |
| 53 cloud_policy_manager_->Shutdown(); | 53 cloud_policy_manager_->Shutdown(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 base::MessageLoop loop_; | 56 base::MessageLoop loop_; |
| 57 SchemaRegistry schema_registry_; | 57 SchemaRegistry schema_registry_; |
| 58 MockConfigurationPolicyProvider mock_provider_; | 58 MockConfigurationPolicyProvider mock_provider_; |
| 59 MockCloudPolicyStore cloud_policy_store_; | 59 MockCloudPolicyStore cloud_policy_store_; |
| 60 scoped_ptr<CloudPolicyManager> cloud_policy_manager_; | 60 scoped_ptr<CloudPolicyManager> cloud_policy_manager_; |
| 61 }; | 61 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue( | 103 value = connector.policy_service()->GetPolicies(chrome_ns).GetValue( |
| 104 key::kAutoFillEnabled); | 104 key::kAutoFillEnabled); |
| 105 ASSERT_TRUE(value); | 105 ASSERT_TRUE(value); |
| 106 EXPECT_TRUE(base::FundamentalValue(true).Equals(value)); | 106 EXPECT_TRUE(base::FundamentalValue(true).Equals(value)); |
| 107 | 107 |
| 108 // Cleanup. | 108 // Cleanup. |
| 109 connector.Shutdown(); | 109 connector.Shutdown(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace policy | 112 } // namespace policy |
| OLD | NEW |