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 <UIKit/UIKit.h> | 5 #include <UIKit/UIKit.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Key in the NSUserDefaults that contains the managed app configuration. | 26 // Key in the NSUserDefaults that contains the managed app configuration. |
27 NSString* const kConfigurationKey = @"com.apple.configuration.managed"; | 27 NSString* const kConfigurationKey = @"com.apple.configuration.managed"; |
28 | 28 |
29 class TestHarness : public PolicyProviderTestHarness { | 29 class TestHarness : public PolicyProviderTestHarness { |
30 public: | 30 public: |
31 // If |use_encoded_key| is true then AddPolicies() serializes and encodes | 31 // If |use_encoded_key| is true then AddPolicies() serializes and encodes |
32 // the policies, and publishes them under the EncodedChromePolicy key. | 32 // the policies, and publishes them under the EncodedChromePolicy key. |
33 explicit TestHarness(bool use_encoded_key); | 33 explicit TestHarness(bool use_encoded_key); |
34 virtual ~TestHarness(); | 34 ~TestHarness() override; |
35 | 35 |
36 virtual void SetUp() override; | 36 void SetUp() override; |
37 | 37 |
38 virtual ConfigurationPolicyProvider* CreateProvider( | 38 ConfigurationPolicyProvider* CreateProvider( |
39 SchemaRegistry* registry, | 39 SchemaRegistry* registry, |
40 scoped_refptr<base::SequencedTaskRunner> task_runner) override; | 40 scoped_refptr<base::SequencedTaskRunner> task_runner) override; |
41 | 41 |
42 virtual void InstallEmptyPolicy() override; | 42 void InstallEmptyPolicy() override; |
43 virtual void InstallStringPolicy(const std::string& policy_name, | 43 void InstallStringPolicy(const std::string& policy_name, |
44 const std::string& policy_value) override; | 44 const std::string& policy_value) override; |
45 virtual void InstallIntegerPolicy(const std::string& policy_name, | 45 void InstallIntegerPolicy(const std::string& policy_name, |
46 int policy_value) override; | 46 int policy_value) override; |
47 virtual void InstallBooleanPolicy(const std::string& policy_name, | 47 void InstallBooleanPolicy(const std::string& policy_name, |
48 bool policy_value) override; | 48 bool policy_value) override; |
49 virtual void InstallStringListPolicy( | 49 void InstallStringListPolicy(const std::string& policy_name, |
50 const std::string& policy_name, | 50 const base::ListValue* policy_value) override; |
51 const base::ListValue* policy_value) override; | 51 void InstallDictionaryPolicy( |
52 virtual void InstallDictionaryPolicy( | |
53 const std::string& policy_name, | 52 const std::string& policy_name, |
54 const base::DictionaryValue* policy_value) override; | 53 const base::DictionaryValue* policy_value) override; |
55 | 54 |
56 static PolicyProviderTestHarness* Create(); | 55 static PolicyProviderTestHarness* Create(); |
57 static PolicyProviderTestHarness* CreateWithEncodedKey(); | 56 static PolicyProviderTestHarness* CreateWithEncodedKey(); |
58 | 57 |
59 private: | 58 private: |
60 // Merges the policies in |policy| into the current policy dictionary | 59 // Merges the policies in |policy| into the current policy dictionary |
61 // in NSUserDefaults, after making sure that the policy dictionary | 60 // in NSUserDefaults, after making sure that the policy dictionary |
62 // exists. | 61 // exists. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 258 |
260 scoped_refptr<base::TestSimpleTaskRunner> taskRunner = | 259 scoped_refptr<base::TestSimpleTaskRunner> taskRunner = |
261 new base::TestSimpleTaskRunner(); | 260 new base::TestSimpleTaskRunner(); |
262 PolicyLoaderIOS loader(taskRunner); | 261 PolicyLoaderIOS loader(taskRunner); |
263 scoped_ptr<PolicyBundle> bundle = loader.Load(); | 262 scoped_ptr<PolicyBundle> bundle = loader.Load(); |
264 ASSERT_TRUE(bundle); | 263 ASSERT_TRUE(bundle); |
265 EXPECT_TRUE(bundle->Equals(expected)); | 264 EXPECT_TRUE(bundle->Equals(expected)); |
266 } | 265 } |
267 | 266 |
268 } // namespace policy | 267 } // namespace policy |
OLD | NEW |