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