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

Side by Side Diff: components/policy/core/common/policy_loader_mac_unittest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 #include <CoreFoundation/CoreFoundation.h> 5 #include <CoreFoundation/CoreFoundation.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/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
11 #include "base/strings/sys_string_conversions.h" 11 #include "base/strings/sys_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "components/policy/core/common/async_policy_provider.h" 13 #include "components/policy/core/common/async_policy_provider.h"
14 #include "components/policy/core/common/configuration_policy_provider_test.h" 14 #include "components/policy/core/common/configuration_policy_provider_test.h"
15 #include "components/policy/core/common/external_data_fetcher.h" 15 #include "components/policy/core/common/external_data_fetcher.h"
16 #include "components/policy/core/common/policy_bundle.h" 16 #include "components/policy/core/common/policy_bundle.h"
17 #include "components/policy/core/common/policy_loader_mac.h" 17 #include "components/policy/core/common/policy_loader_mac.h"
18 #include "components/policy/core/common/policy_map.h" 18 #include "components/policy/core/common/policy_map.h"
19 #include "components/policy/core/common/policy_test_utils.h" 19 #include "components/policy/core/common/policy_test_utils.h"
20 #include "components/policy/core/common/policy_types.h"
21 #include "components/policy/core/common/preferences_mock_mac.h" 20 #include "components/policy/core/common/preferences_mock_mac.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 using base::ScopedCFTypeRef; 23 using base::ScopedCFTypeRef;
25 24
26 namespace policy { 25 namespace policy {
27 26
28 namespace { 27 namespace {
29 28
30 class TestHarness : public PolicyProviderTestHarness { 29 class TestHarness : public PolicyProviderTestHarness {
(...skipping 22 matching lines...) Expand all
53 52
54 static PolicyProviderTestHarness* Create(); 53 static PolicyProviderTestHarness* Create();
55 54
56 private: 55 private:
57 MockPreferences* prefs_; 56 MockPreferences* prefs_;
58 57
59 DISALLOW_COPY_AND_ASSIGN(TestHarness); 58 DISALLOW_COPY_AND_ASSIGN(TestHarness);
60 }; 59 };
61 60
62 TestHarness::TestHarness() 61 TestHarness::TestHarness()
63 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 62 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER) {}
64 POLICY_SOURCE_PLATFORM) {}
65 63
66 TestHarness::~TestHarness() {} 64 TestHarness::~TestHarness() {}
67 65
68 void TestHarness::SetUp() {} 66 void TestHarness::SetUp() {}
69 67
70 ConfigurationPolicyProvider* TestHarness::CreateProvider( 68 ConfigurationPolicyProvider* TestHarness::CreateProvider(
71 SchemaRegistry* registry, 69 SchemaRegistry* registry,
72 scoped_refptr<base::SequencedTaskRunner> task_runner) { 70 scoped_refptr<base::SequencedTaskRunner> task_runner) {
73 prefs_ = new MockPreferences(); 71 prefs_ = new MockPreferences();
74 scoped_ptr<AsyncPolicyLoader> loader( 72 scoped_ptr<AsyncPolicyLoader> loader(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 prefs_->AddTestItem(name, test_value.get(), false); 183 prefs_->AddTestItem(name, test_value.get(), false);
186 184
187 // Make the provider read the updated |prefs_|. 185 // Make the provider read the updated |prefs_|.
188 provider_->RefreshPolicies(); 186 provider_->RefreshPolicies();
189 loop_.RunUntilIdle(); 187 loop_.RunUntilIdle();
190 PolicyBundle expected_bundle; 188 PolicyBundle expected_bundle;
191 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 189 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
192 .Set(test_keys::kKeyString, 190 .Set(test_keys::kKeyString,
193 POLICY_LEVEL_RECOMMENDED, 191 POLICY_LEVEL_RECOMMENDED,
194 POLICY_SCOPE_USER, 192 POLICY_SCOPE_USER,
195 POLICY_SOURCE_PLATFORM,
196 new base::StringValue("string value"), 193 new base::StringValue("string value"),
197 NULL); 194 NULL);
198 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); 195 EXPECT_TRUE(provider_->policies().Equals(expected_bundle));
199 } 196 }
200 197
201 } // namespace policy 198 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_loader_mac.mm ('k') | components/policy/core/common/policy_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698