| 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 15 matching lines...) Expand all Loading... |
| 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 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) OVERRIDE; | 40 scoped_refptr<base::SequencedTaskRunner> task_runner) override; |
| 41 | 41 |
| 42 virtual void InstallEmptyPolicy() OVERRIDE; | 42 virtual void InstallEmptyPolicy() override; |
| 43 virtual void InstallStringPolicy(const std::string& policy_name, | 43 virtual 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 virtual 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 virtual void InstallBooleanPolicy(const std::string& policy_name, |
| 48 bool policy_value) OVERRIDE; | 48 bool policy_value) override; |
| 49 virtual void InstallStringListPolicy( | 49 virtual void InstallStringListPolicy( |
| 50 const std::string& policy_name, | 50 const std::string& policy_name, |
| 51 const base::ListValue* policy_value) OVERRIDE; | 51 const base::ListValue* policy_value) override; |
| 52 virtual void InstallDictionaryPolicy( | 52 virtual void InstallDictionaryPolicy( |
| 53 const std::string& policy_name, | 53 const std::string& policy_name, |
| 54 const base::DictionaryValue* policy_value) OVERRIDE; | 54 const base::DictionaryValue* policy_value) override; |
| 55 | 55 |
| 56 static PolicyProviderTestHarness* Create(); | 56 static PolicyProviderTestHarness* Create(); |
| 57 static PolicyProviderTestHarness* CreateWithEncodedKey(); | 57 static PolicyProviderTestHarness* CreateWithEncodedKey(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 // Merges the policies in |policy| into the current policy dictionary | 60 // Merges the policies in |policy| into the current policy dictionary |
| 61 // in NSUserDefaults, after making sure that the policy dictionary | 61 // in NSUserDefaults, after making sure that the policy dictionary |
| 62 // exists. | 62 // exists. |
| 63 void AddPolicies(NSDictionary* policy); | 63 void AddPolicies(NSDictionary* policy); |
| 64 void AddChromePolicy(NSDictionary* policy); | 64 void AddChromePolicy(NSDictionary* policy); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 scoped_refptr<base::TestSimpleTaskRunner> taskRunner = | 272 scoped_refptr<base::TestSimpleTaskRunner> taskRunner = |
| 273 new base::TestSimpleTaskRunner(); | 273 new base::TestSimpleTaskRunner(); |
| 274 PolicyLoaderIOS loader(taskRunner); | 274 PolicyLoaderIOS loader(taskRunner); |
| 275 scoped_ptr<PolicyBundle> bundle = loader.Load(); | 275 scoped_ptr<PolicyBundle> bundle = loader.Load(); |
| 276 ASSERT_TRUE(bundle); | 276 ASSERT_TRUE(bundle); |
| 277 EXPECT_TRUE(bundle->Equals(expected)); | 277 EXPECT_TRUE(bundle->Equals(expected)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace policy | 280 } // namespace policy |
| OLD | NEW |