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

Side by Side Diff: chrome/browser/extensions/external_policy_loader_unittest.cc

Issue 140343002: extensions: Relocate pref name constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing include for mac 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
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "base/version.h" 11 #include "base/version.h"
12 #include "chrome/browser/extensions/external_policy_loader.h" 12 #include "chrome/browser/extensions/external_policy_loader.h"
13 #include "chrome/browser/extensions/external_provider_impl.h" 13 #include "chrome/browser/extensions/external_provider_impl.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/testing_pref_service_syncable.h" 15 #include "chrome/test/base/testing_pref_service_syncable.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/test/test_browser_thread.h" 17 #include "content/public/test/test_browser_thread.h"
18 #include "extensions/browser/external_provider_interface.h" 18 #include "extensions/browser/external_provider_interface.h"
19 #include "extensions/browser/pref_names.h"
19 #include "extensions/common/extension.h" 20 #include "extensions/common/extension.h"
20 #include "extensions/common/manifest.h" 21 #include "extensions/common/manifest.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 class ExternalPolicyLoaderTest : public testing::Test { 28 class ExternalPolicyLoaderTest : public testing::Test {
28 public: 29 public:
(...skipping 16 matching lines...) Expand all
45 public: 46 public:
46 MockExternalPolicyProviderVisitor() { 47 MockExternalPolicyProviderVisitor() {
47 } 48 }
48 49
49 // Initialize a provider with |policy_forcelist|, and check that it installs 50 // Initialize a provider with |policy_forcelist|, and check that it installs
50 // exactly the extensions specified in |expected_extensions|. 51 // exactly the extensions specified in |expected_extensions|.
51 void Visit(const base::DictionaryValue& policy_forcelist, 52 void Visit(const base::DictionaryValue& policy_forcelist,
52 const std::set<std::string>& expected_extensions) { 53 const std::set<std::string>& expected_extensions) {
53 profile_.reset(new TestingProfile); 54 profile_.reset(new TestingProfile);
54 profile_->GetTestingPrefService()->SetManagedPref( 55 profile_->GetTestingPrefService()->SetManagedPref(
55 prefs::kExtensionInstallForceList, 56 pref_names::kInstallForceList, policy_forcelist.DeepCopy());
56 policy_forcelist.DeepCopy());
57 provider_.reset(new ExternalProviderImpl( 57 provider_.reset(new ExternalProviderImpl(
58 this, 58 this,
59 new ExternalPolicyLoader(profile_.get()), 59 new ExternalPolicyLoader(profile_.get()),
60 profile_.get(), 60 profile_.get(),
61 Manifest::INVALID_LOCATION, 61 Manifest::INVALID_LOCATION,
62 Manifest::EXTERNAL_POLICY_DOWNLOAD, 62 Manifest::EXTERNAL_POLICY_DOWNLOAD,
63 Extension::NO_FLAGS)); 63 Extension::NO_FLAGS));
64 64
65 // Extensions will be removed from this list as they visited, 65 // Extensions will be removed from this list as they visited,
66 // so it should be emptied by the end. 66 // so it should be emptied by the end.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 forced_extensions.SetString("invalid", "http://www.example.com/crx"); 142 forced_extensions.SetString("invalid", "http://www.example.com/crx");
143 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", 143 forced_extensions.SetString("dddddddddddddddddddddddddddddddd",
144 std::string()); 144 std::string());
145 forced_extensions.SetString("invalid", "bad"); 145 forced_extensions.SetString("invalid", "bad");
146 146
147 MockExternalPolicyProviderVisitor mv; 147 MockExternalPolicyProviderVisitor mv;
148 mv.Visit(forced_extensions, expected_extensions); 148 mv.Visit(forced_extensions, expected_extensions);
149 } 149 }
150 150
151 } // namespace extensions 151 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698