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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 class TestHarness : public PolicyProviderTestHarness { | 30 class TestHarness : public PolicyProviderTestHarness { |
31 public: | 31 public: |
32 explicit TestHarness(PolicyLevel level); | 32 explicit TestHarness(PolicyLevel level); |
33 virtual ~TestHarness(); | 33 virtual ~TestHarness(); |
34 | 34 |
35 virtual void SetUp() OVERRIDE; | 35 virtual void SetUp() OVERRIDE; |
36 | 36 |
37 virtual ConfigurationPolicyProvider* CreateProvider( | 37 virtual ConfigurationPolicyProvider* CreateProvider( |
38 SchemaRegistry* registry, | 38 SchemaRegistry* registry, |
39 scoped_refptr<base::SequencedTaskRunner> task_runner, | 39 scoped_refptr<base::SequencedTaskRunner> task_runner) OVERRIDE; |
40 const PolicyDefinitionList* policy_definition_list) OVERRIDE; | |
41 | 40 |
42 virtual void InstallEmptyPolicy() OVERRIDE; | 41 virtual void InstallEmptyPolicy() OVERRIDE; |
43 virtual void InstallStringPolicy(const std::string& policy_name, | 42 virtual void InstallStringPolicy(const std::string& policy_name, |
44 const std::string& policy_value) OVERRIDE; | 43 const std::string& policy_value) OVERRIDE; |
45 virtual void InstallIntegerPolicy(const std::string& policy_name, | 44 virtual void InstallIntegerPolicy(const std::string& policy_name, |
46 int policy_value) OVERRIDE; | 45 int policy_value) OVERRIDE; |
47 virtual void InstallBooleanPolicy(const std::string& policy_name, | 46 virtual void InstallBooleanPolicy(const std::string& policy_name, |
48 bool policy_value) OVERRIDE; | 47 bool policy_value) OVERRIDE; |
49 virtual void InstallStringListPolicy( | 48 virtual void InstallStringListPolicy( |
50 const std::string& policy_name, | 49 const std::string& policy_name, |
(...skipping 14 matching lines...) Expand all Loading... |
65 | 64 |
66 TestHarness::TestHarness(PolicyLevel level) | 65 TestHarness::TestHarness(PolicyLevel level) |
67 : PolicyProviderTestHarness(level, POLICY_SCOPE_USER) {} | 66 : PolicyProviderTestHarness(level, POLICY_SCOPE_USER) {} |
68 | 67 |
69 TestHarness::~TestHarness() {} | 68 TestHarness::~TestHarness() {} |
70 | 69 |
71 void TestHarness::SetUp() {} | 70 void TestHarness::SetUp() {} |
72 | 71 |
73 ConfigurationPolicyProvider* TestHarness::CreateProvider( | 72 ConfigurationPolicyProvider* TestHarness::CreateProvider( |
74 SchemaRegistry* registry, | 73 SchemaRegistry* registry, |
75 scoped_refptr<base::SequencedTaskRunner> task_runner, | 74 scoped_refptr<base::SequencedTaskRunner> task_runner) { |
76 const PolicyDefinitionList* policy_definition_list) { | |
77 // Create and initialize the store. | 75 // Create and initialize the store. |
78 store_.NotifyStoreLoaded(); | 76 store_.NotifyStoreLoaded(); |
79 ConfigurationPolicyProvider* provider = new CloudPolicyManager( | 77 ConfigurationPolicyProvider* provider = new CloudPolicyManager( |
80 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), | 78 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), |
81 &store_, | 79 &store_, |
82 task_runner); | 80 task_runner); |
83 Mock::VerifyAndClearExpectations(&store_); | 81 Mock::VerifyAndClearExpectations(&store_); |
84 return provider; | 82 return provider; |
85 } | 83 } |
86 | 84 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); | 340 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); |
343 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); | 341 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); |
344 store_.NotifyStoreError(); | 342 store_.NotifyStoreError(); |
345 Mock::VerifyAndClearExpectations(&observer_); | 343 Mock::VerifyAndClearExpectations(&observer_); |
346 | 344 |
347 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 345 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
348 } | 346 } |
349 | 347 |
350 } // namespace | 348 } // namespace |
351 } // namespace policy | 349 } // namespace policy |
OLD | NEW |