OLD | NEW |
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/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 MockExternalPolicyProviderVisitor() { | 47 MockExternalPolicyProviderVisitor() { |
48 } | 48 } |
49 | 49 |
50 // Initialize a provider with |policy_forcelist|, and check that it installs | 50 // Initialize a provider with |policy_forcelist|, and check that it installs |
51 // exactly the extensions specified in |expected_extensions|. | 51 // exactly the extensions specified in |expected_extensions|. |
52 void Visit(const base::DictionaryValue& policy_forcelist, | 52 void Visit(const base::DictionaryValue& policy_forcelist, |
53 const std::set<std::string>& expected_extensions) { | 53 const std::set<std::string>& expected_extensions) { |
54 profile_.reset(new TestingProfile); | 54 profile_.reset(new TestingProfile); |
55 profile_->GetTestingPrefService()->SetManagedPref( | 55 profile_->GetTestingPrefService()->SetManagedPref( |
56 pref_names::kInstallForceList, policy_forcelist.DeepCopy()); | 56 pref_names::kInstallForceList, policy_forcelist.CreateDeepCopy()); |
57 provider_.reset(new ExternalProviderImpl( | 57 provider_.reset(new ExternalProviderImpl( |
58 this, | 58 this, |
59 new ExternalPolicyLoader( | 59 new ExternalPolicyLoader( |
60 ExtensionManagementFactory::GetForBrowserContext(profile_.get()), | 60 ExtensionManagementFactory::GetForBrowserContext(profile_.get()), |
61 ExternalPolicyLoader::FORCED), | 61 ExternalPolicyLoader::FORCED), |
62 profile_.get(), | 62 profile_.get(), |
63 Manifest::INVALID_LOCATION, | 63 Manifest::INVALID_LOCATION, |
64 Manifest::EXTERNAL_POLICY_DOWNLOAD, | 64 Manifest::EXTERNAL_POLICY_DOWNLOAD, |
65 Extension::NO_FLAGS)); | 65 Extension::NO_FLAGS)); |
66 | 66 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 forced_extensions.SetString("invalid", "http://www.example.com/crx"); | 150 forced_extensions.SetString("invalid", "http://www.example.com/crx"); |
151 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", | 151 forced_extensions.SetString("dddddddddddddddddddddddddddddddd", |
152 std::string()); | 152 std::string()); |
153 forced_extensions.SetString("invalid", "bad"); | 153 forced_extensions.SetString("invalid", "bad"); |
154 | 154 |
155 MockExternalPolicyProviderVisitor mv; | 155 MockExternalPolicyProviderVisitor mv; |
156 mv.Visit(forced_extensions, expected_extensions); | 156 mv.Visit(forced_extensions, expected_extensions); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |