Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/extension_service_test_base.h" | 5 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 23 #include "components/pref_registry/pref_registry_syncable.h" | 23 #include "components/pref_registry/pref_registry_syncable.h" |
| 24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
| 25 #include "extensions/browser/extension_prefs.h" | 25 #include "extensions/browser/extension_prefs.h" |
| 26 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
| 27 | 27 |
| 28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 29 #include "chrome/browser/chromeos/extensions/install_limiter.h" | 29 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 #if defined(OS_WIN) | |
| 33 #include "chrome/browser/prefs/incognito_mode_prefs.h" | |
| 34 #endif | |
| 35 | |
| 32 namespace extensions { | 36 namespace extensions { |
| 33 | 37 |
| 34 namespace { | 38 namespace { |
| 35 | 39 |
| 36 // Create a testing profile according to |params|. | 40 // Create a testing profile according to |params|. |
| 37 scoped_ptr<TestingProfile> BuildTestingProfile( | 41 scoped_ptr<TestingProfile> BuildTestingProfile( |
| 38 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) { | 42 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) { |
| 39 TestingProfile::Builder profile_builder; | 43 TestingProfile::Builder profile_builder; |
| 40 // Create a PrefService that only contains user defined preference values. | 44 // Create a PrefService that only contains user defined preference values. |
| 41 PrefServiceMockFactory factory; | 45 PrefServiceMockFactory factory; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 params.autoupdate_enabled = true; | 172 params.autoupdate_enabled = true; |
| 169 InitializeExtensionService(params); | 173 InitializeExtensionService(params); |
| 170 service_->updater()->Start(); | 174 service_->updater()->Start(); |
| 171 } | 175 } |
| 172 | 176 |
| 173 void ExtensionServiceTestBase::SetUp() { | 177 void ExtensionServiceTestBase::SetUp() { |
| 174 ExtensionErrorReporter::GetInstance()->ClearErrors(); | 178 ExtensionErrorReporter::GetInstance()->ClearErrors(); |
| 175 } | 179 } |
| 176 | 180 |
| 177 void ExtensionServiceTestBase::SetUpTestCase() { | 181 void ExtensionServiceTestBase::SetUpTestCase() { |
| 182 #if defined(OS_WIN) | |
| 183 IncognitoModePrefs::InitializePlatformParentalControls(); | |
|
not at google - send to devlin
2015/02/26 23:36:12
Kinda weird for this arbitrary thing in Extensions
robliao
2015/02/27 21:54:52
Added a comment.
| |
| 184 #endif // defined(OS_WIN) | |
| 178 // Safe to call multiple times. | 185 // Safe to call multiple times. |
| 179 ExtensionErrorReporter::Init(false); // no noisy errors. | 186 ExtensionErrorReporter::Init(false); // no noisy errors. |
| 180 } | 187 } |
| 181 | 188 |
| 182 // These are declared in the .cc so that all inheritors don't need to know | 189 // These are declared in the .cc so that all inheritors don't need to know |
| 183 // that TestingProfile derives Profile derives BrowserContext. | 190 // that TestingProfile derives Profile derives BrowserContext. |
| 184 content::BrowserContext* ExtensionServiceTestBase::browser_context() { | 191 content::BrowserContext* ExtensionServiceTestBase::browser_context() { |
| 185 return profile_.get(); | 192 return profile_.get(); |
| 186 } | 193 } |
| 187 | 194 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 216 // interfere with the tests. Those tests that need an external provider | 223 // interfere with the tests. Those tests that need an external provider |
| 217 // will register one specifically. | 224 // will register one specifically. |
| 218 service_->ClearProvidersForTesting(); | 225 service_->ClearProvidersForTesting(); |
| 219 | 226 |
| 220 #if defined(OS_CHROMEOS) | 227 #if defined(OS_CHROMEOS) |
| 221 InstallLimiter::Get(profile_.get())->DisableForTest(); | 228 InstallLimiter::Get(profile_.get())->DisableForTest(); |
| 222 #endif | 229 #endif |
| 223 } | 230 } |
| 224 | 231 |
| 225 } // namespace extensions | 232 } // namespace extensions |
| OLD | NEW |