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

Side by Side Diff: chrome/browser/policy/url_blacklist_policy_handler_unittest.cc

Issue 140803003: Move the Autofill and URLBlacklist policy handlers to the component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trying again... Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/url_blacklist_policy_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/prefs/pref_value_map.h" 6 #include "base/prefs/pref_value_map.h"
7 #include "chrome/browser/policy/url_blacklist_policy_handler.h" 7 #include "base/values.h"
8 #include "components/policy/core/browser/policy_error_map.h" 8 #include "components/policy/core/browser/policy_error_map.h"
9 #include "components/policy/core/browser/url_blacklist_policy_handler.h"
9 #include "components/policy/core/common/policy_map.h" 10 #include "components/policy/core/common/policy_map.h"
10 #include "components/policy/core/common/policy_pref_names.h" 11 #include "components/policy/core/common/policy_pref_names.h"
11 #include "grit/generated_resources.h"
12 #include "policy/policy_constants.h" 12 #include "policy/policy_constants.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 // Note: this file should move to components/policy/core/browser, but the
16 // components_unittests runner does not load the ResourceBundle as
17 // ChromeTestSuite::Initialize does, which leads to failures using
18 // PolicyErrorMap.
19
15 namespace policy { 20 namespace policy {
16 21
17 namespace { 22 namespace {
23
18 const char kTestDisabledScheme[] = "kTestDisabledScheme"; 24 const char kTestDisabledScheme[] = "kTestDisabledScheme";
19 const char kTestBlacklistValue[] = "kTestBlacklistValue"; 25 const char kTestBlacklistValue[] = "kTestBlacklistValue";
26
20 } // namespace 27 } // namespace
21 28
22 class URLBlacklistPolicyHandlerTest : public testing::Test { 29 class URLBlacklistPolicyHandlerTest : public testing::Test {
23 protected: 30 protected:
24 void SetPolicy(const std::string& key, base::Value* value) { 31 void SetPolicy(const std::string& key, base::Value* value) {
25 policies_.Set(key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, value, NULL); 32 policies_.Set(key, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, value, NULL);
26 } 33 }
27 bool CheckPolicy(const std::string& key, base::Value* value) { 34 bool CheckPolicy(const std::string& key, base::Value* value) {
28 SetPolicy(key, value); 35 SetPolicy(key, value);
29 return handler_.CheckPolicySettings(policies_, &errors_); 36 return handler_.CheckPolicySettings(policies_, &errors_);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 std::string out1; 210 std::string out1;
204 EXPECT_TRUE(out_list->GetString(0U, &out1)); 211 EXPECT_TRUE(out_list->GetString(0U, &out1));
205 EXPECT_EQ(kTestDisabledScheme + std::string("://*"), out1); 212 EXPECT_EQ(kTestDisabledScheme + std::string("://*"), out1);
206 213
207 std::string out2; 214 std::string out2;
208 EXPECT_TRUE(out_list->GetString(1U, &out2)); 215 EXPECT_TRUE(out_list->GetString(1U, &out2));
209 EXPECT_EQ(kTestBlacklistValue, out2); 216 EXPECT_EQ(kTestBlacklistValue, out2);
210 } 217 }
211 218
212 } // namespace policy 219 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/url_blacklist_policy_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698