Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/policy/configuration_policy_provider_test.h

Issue 10496013: Implement the mac policy provider based on the AsyncPolicyLoader. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed to PolicyLoaderMac Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "chrome/browser/policy/asynchronous_policy_test_base.h" 15 #include "chrome/browser/policy/policy_constants.h"
16 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/test/test_browser_thread.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace base { 19 namespace base {
20 class DictionaryValue; 20 class DictionaryValue;
21 class ListValue; 21 class ListValue;
22 class Value; 22 class Value;
23 } 23 }
24 24
25 namespace policy { 25 namespace policy {
(...skipping 10 matching lines...) Expand all
36 extern const char kKeyBoolean[]; 36 extern const char kKeyBoolean[];
37 extern const char kKeyInteger[]; 37 extern const char kKeyInteger[];
38 extern const char kKeyStringList[]; 38 extern const char kKeyStringList[];
39 extern const char kKeyDictionary[]; 39 extern const char kKeyDictionary[];
40 40
41 // Policy definition list that contains entries for the keys above. 41 // Policy definition list that contains entries for the keys above.
42 extern const PolicyDefinitionList kList; 42 extern const PolicyDefinitionList kList;
43 43
44 } // namespace test_policy_definitions 44 } // namespace test_policy_definitions
45 45
46 class PolicyTestBase : public testing::Test {
47 public:
48 PolicyTestBase();
49 virtual ~PolicyTestBase();
50
51 // testing::Test:
52 virtual void TearDown() OVERRIDE;
53
54 protected:
55 // Create an actual IO loop (needed by FilePathWatcher).
56 MessageLoopForIO loop_;
57
58 private:
59 content::TestBrowserThread ui_thread_;
60 content::TestBrowserThread file_thread_;
61
62 DISALLOW_COPY_AND_ASSIGN(PolicyTestBase);
63 };
64
46 // An interface for creating a test policy provider and creating a policy 65 // An interface for creating a test policy provider and creating a policy
47 // provider instance for testing. Used as the parameter to the abstract 66 // provider instance for testing. Used as the parameter to the abstract
48 // ConfigurationPolicyProviderTest below. 67 // ConfigurationPolicyProviderTest below.
49 class PolicyProviderTestHarness { 68 class PolicyProviderTestHarness {
50 public: 69 public:
51 // |level| and |scope| are the level and scope of the policies returned by 70 // |level| and |scope| are the level and scope of the policies returned by
52 // the providers from CreateProvider(). 71 // the providers from CreateProvider().
53 PolicyProviderTestHarness(PolicyLevel level, PolicyScope scope); 72 PolicyProviderTestHarness(PolicyLevel level, PolicyScope scope);
54 virtual ~PolicyProviderTestHarness(); 73 virtual ~PolicyProviderTestHarness();
55 74
(...skipping 29 matching lines...) Expand all
85 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness); 104 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness);
86 }; 105 };
87 106
88 // A factory method for creating a test harness. 107 // A factory method for creating a test harness.
89 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)(); 108 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)();
90 109
91 // Abstract policy provider test. This is meant to be instantiated for each 110 // Abstract policy provider test. This is meant to be instantiated for each
92 // policy provider implementation, passing in a suitable harness factory 111 // policy provider implementation, passing in a suitable harness factory
93 // function as the test parameter. 112 // function as the test parameter.
94 class ConfigurationPolicyProviderTest 113 class ConfigurationPolicyProviderTest
95 : public AsynchronousPolicyTestBase, 114 : public PolicyTestBase,
96 public testing::WithParamInterface<CreatePolicyProviderTestHarness> { 115 public testing::WithParamInterface<CreatePolicyProviderTestHarness> {
97 protected: 116 protected:
98 ConfigurationPolicyProviderTest(); 117 ConfigurationPolicyProviderTest();
99 virtual ~ConfigurationPolicyProviderTest(); 118 virtual ~ConfigurationPolicyProviderTest();
100 119
101 virtual void SetUp() OVERRIDE; 120 virtual void SetUp() OVERRIDE;
102 virtual void TearDown() OVERRIDE; 121 virtual void TearDown() OVERRIDE;
103 122
104 // Installs a valid policy and checks whether the provider returns the 123 // Installs a valid policy and checks whether the provider returns the
105 // |expected_value|. 124 // |expected_value|.
106 void CheckValue(const char* policy_name, 125 void CheckValue(const char* policy_name,
107 const base::Value& expected_value, 126 const base::Value& expected_value,
108 base::Closure install_value); 127 base::Closure install_value);
109 128
110 scoped_ptr<PolicyProviderTestHarness> test_harness_; 129 scoped_ptr<PolicyProviderTestHarness> test_harness_;
111 scoped_ptr<ConfigurationPolicyProvider> provider_; 130 scoped_ptr<ConfigurationPolicyProvider> provider_;
112 131
113 private: 132 private:
114 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderTest); 133 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderTest);
115 }; 134 };
116 135
117 } // namespace policy 136 } // namespace policy
118 137
119 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 138 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_mac.h ('k') | chrome/browser/policy/configuration_policy_provider_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698