| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cloud/cloud_policy_manager.h" | 5 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "chrome/browser/invalidation/fake_invalidation_service.h" |
| 12 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 13 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
| 13 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h" | 14 #include "chrome/browser/policy/cloud/mock_cloud_policy_client.h" |
| 14 #include "chrome/browser/policy/cloud/mock_cloud_policy_store.h" | 15 #include "chrome/browser/policy/cloud/mock_cloud_policy_store.h" |
| 15 #include "chrome/browser/policy/cloud/policy_builder.h" | 16 #include "chrome/browser/policy/cloud/policy_builder.h" |
| 16 #include "chrome/browser/policy/configuration_policy_provider_test.h" | 17 #include "chrome/browser/policy/configuration_policy_provider_test.h" |
| 17 #include "chrome/browser/policy/external_data_fetcher.h" | 18 #include "chrome/browser/policy/external_data_fetcher.h" |
| 18 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 19 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 20 #include "sync/notifier/invalidation_util.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 23 |
| 22 using testing::Mock; | 24 using testing::Mock; |
| 23 using testing::_; | 25 using testing::_; |
| 24 | 26 |
| 25 namespace em = enterprise_management; | 27 namespace em = enterprise_management; |
| 26 | 28 |
| 27 namespace policy { | 29 namespace policy { |
| 28 namespace { | 30 namespace { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 dm_protocol::kChromeUserPolicyType, | 138 dm_protocol::kChromeUserPolicyType, |
| 137 std::string()), | 139 std::string()), |
| 138 store) {} | 140 store) {} |
| 139 virtual ~TestCloudPolicyManager() {} | 141 virtual ~TestCloudPolicyManager() {} |
| 140 | 142 |
| 141 // Publish the protected members for testing. | 143 // Publish the protected members for testing. |
| 142 using CloudPolicyManager::client; | 144 using CloudPolicyManager::client; |
| 143 using CloudPolicyManager::store; | 145 using CloudPolicyManager::store; |
| 144 using CloudPolicyManager::service; | 146 using CloudPolicyManager::service; |
| 145 using CloudPolicyManager::CheckAndPublishPolicy; | 147 using CloudPolicyManager::CheckAndPublishPolicy; |
| 148 using CloudPolicyManager::StartRefreshScheduler; |
| 146 | 149 |
| 147 private: | 150 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(TestCloudPolicyManager); | 151 DISALLOW_COPY_AND_ASSIGN(TestCloudPolicyManager); |
| 149 }; | 152 }; |
| 150 | 153 |
| 151 MATCHER_P(ProtoMatches, proto, "") { | 154 MATCHER_P(ProtoMatches, proto, "") { |
| 152 return arg.SerializePartialAsString() == proto.SerializePartialAsString(); | 155 return arg.SerializePartialAsString() == proto.SerializePartialAsString(); |
| 153 } | 156 } |
| 154 | 157 |
| 155 class CloudPolicyManagerTest : public testing::Test { | 158 class CloudPolicyManagerTest : public testing::Test { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); | 335 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); |
| 333 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); | 336 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); |
| 334 store_.NotifyStoreError(); | 337 store_.NotifyStoreError(); |
| 335 Mock::VerifyAndClearExpectations(&observer_); | 338 Mock::VerifyAndClearExpectations(&observer_); |
| 336 | 339 |
| 337 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 340 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 338 } | 341 } |
| 339 | 342 |
| 340 } // namespace | 343 } // namespace |
| 341 } // namespace policy | 344 } // namespace policy |
| OLD | NEW |