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

Unified Diff: chrome/browser/extensions/extension_startup_browsertest.cc

Issue 10037023: Enable UserDataDir selection in InProcessBrowserTest (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed issues with tests using InProcessBrowserTest Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_startup_browsertest.cc
diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc
index 37757451f3d69c68f0aabac0f4db3515ed7cf5ad..d2a5f531dbe650bbcee59f393db56a47a782d768 100644
--- a/chrome/browser/extensions/extension_startup_browsertest.cc
+++ b/chrome/browser/extensions/extension_startup_browsertest.cc
@@ -38,6 +38,18 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
virtual void SetUpCommandLine(CommandLine* command_line) {
EnableDOMAutomation();
+ if (!enable_extensions_)
+ command_line->AppendSwitch(switches::kDisableExtensions);
+
+ if (!load_extensions_.empty()) {
+ FilePath::StringType paths = JoinString(load_extensions_, ',');
+ command_line->AppendSwitchNative(switches::kLoadExtension,
+ paths);
+ command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck);
+ }
+ }
+
+ virtual bool SetUpUserDataDirectory() {
FilePath profile_dir;
PathService::Get(chrome::DIR_USER_DATA, &profile_dir);
profile_dir = profile_dir.AppendASCII("Default");
@@ -47,27 +59,17 @@ class ExtensionStartupTestBase : public InProcessBrowserTest {
user_scripts_dir_ = profile_dir.AppendASCII("User Scripts");
extensions_dir_ = profile_dir.AppendASCII("Extensions");
- if (enable_extensions_) {
- if (load_extensions_.empty()) {
- FilePath src_dir;
- PathService::Get(chrome::DIR_TEST_DATA, &src_dir);
- src_dir = src_dir.AppendASCII("extensions").AppendASCII("good");
-
- file_util::CopyFile(src_dir.AppendASCII("Preferences"),
- preferences_file_);
- file_util::CopyDirectory(src_dir.AppendASCII("Extensions"),
- profile_dir, true); // recursive
- }
- } else {
- command_line->AppendSwitch(switches::kDisableExtensions);
- }
+ if (enable_extensions_ && load_extensions_.empty()) {
+ FilePath src_dir;
+ PathService::Get(chrome::DIR_TEST_DATA, &src_dir);
+ src_dir = src_dir.AppendASCII("extensions").AppendASCII("good");
- if (!load_extensions_.empty()) {
- FilePath::StringType paths = JoinString(load_extensions_, ',');
- command_line->AppendSwitchNative(switches::kLoadExtension,
- paths);
- command_line->AppendSwitch(switches::kDisableExtensionsFileAccessCheck);
+ file_util::CopyFile(src_dir.AppendASCII("Preferences"),
+ preferences_file_);
+ file_util::CopyDirectory(src_dir.AppendASCII("Extensions"),
+ profile_dir, true); // recursive
}
+ return true;
}
virtual void TearDown() {

Powered by Google App Engine
This is Rietveld 408576698