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

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

Issue 536753003: Add recommended extension installation support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-3
Patch Set: rebase, more fix Created 6 years, 2 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 <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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Initialize a provider with |policy_forcelist|, and check that it installs 49 // Initialize a provider with |policy_forcelist|, and check that it installs
50 // exactly the extensions specified in |expected_extensions|. 50 // exactly the extensions specified in |expected_extensions|.
51 void Visit(const base::DictionaryValue& policy_forcelist, 51 void Visit(const base::DictionaryValue& policy_forcelist,
52 const std::set<std::string>& expected_extensions) { 52 const std::set<std::string>& expected_extensions) {
53 profile_.reset(new TestingProfile); 53 profile_.reset(new TestingProfile);
54 profile_->GetTestingPrefService()->SetManagedPref( 54 profile_->GetTestingPrefService()->SetManagedPref(
55 pref_names::kInstallForceList, policy_forcelist.DeepCopy()); 55 pref_names::kInstallForceList, policy_forcelist.DeepCopy());
56 provider_.reset(new ExternalProviderImpl( 56 provider_.reset(new ExternalProviderImpl(
57 this, 57 this,
58 new ExternalPolicyLoader( 58 new ExternalPolicyLoader(
59 ExtensionManagementFactory::GetForBrowserContext(profile_.get())), 59 ExtensionManagementFactory::GetForBrowserContext(profile_.get()),
60 ExternalPolicyLoader::FORCED),
60 profile_.get(), 61 profile_.get(),
61 Manifest::INVALID_LOCATION, 62 Manifest::INVALID_LOCATION,
62 Manifest::EXTERNAL_POLICY_DOWNLOAD, 63 Manifest::EXTERNAL_POLICY_DOWNLOAD,
63 Extension::NO_FLAGS)); 64 Extension::NO_FLAGS));
64 65
65 // Extensions will be removed from this list as they visited, 66 // Extensions will be removed from this list as they visited,
66 // so it should be emptied by the end. 67 // so it should be emptied by the end.
67 expected_extensions_ = expected_extensions; 68 expected_extensions_ = expected_extensions;
68 provider_->VisitRegisteredExtension(); 69 provider_->VisitRegisteredExtension();
69 EXPECT_TRUE(expected_extensions_.empty()); 70 EXPECT_TRUE(expected_extensions_.empty());
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 forced_extensions.SetString("invalid", "http://www.example.com/crx"); 147 forced_extensions.SetString("invalid", "http://www.example.com/crx");
147 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", 148 forced_extensions.SetString("dddddddddddddddddddddddddddddddd",
148 std::string()); 149 std::string());
149 forced_extensions.SetString("invalid", "bad"); 150 forced_extensions.SetString("invalid", "bad");
150 151
151 MockExternalPolicyProviderVisitor mv; 152 MockExternalPolicyProviderVisitor mv;
152 mv.Visit(forced_extensions, expected_extensions); 153 mv.Visit(forced_extensions, expected_extensions);
153 } 154 }
154 155
155 } // namespace extensions 156 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_policy_loader.cc ('k') | chrome/browser/extensions/external_provider_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698