summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 15:52:15 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 15:52:15 +0000
commitaae3406d662a2a3278f7b180135ecc9a939a99b1 (patch)
treef44206dac1a93d960b1ce84fe4e050d9f5131f02
parente82e4f4861eaba64e49c26a4d2b0f52af674bc13 (diff)
downloadchromium_src-aae3406d662a2a3278f7b180135ecc9a939a99b1.zip
chromium_src-aae3406d662a2a3278f7b180135ecc9a939a99b1.tar.gz
chromium_src-aae3406d662a2a3278f7b180135ecc9a939a99b1.tar.bz2
Use a temp dir for the BrowserContext when content_shell is running as a browser_test.
BUG=90448 Review URL: https://chromiumcodereview.appspot.com/10815002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147451 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/shell/shell_browser_context.cc4
-rw-r--r--content/shell/shell_switches.cc3
-rw-r--r--content/shell/shell_switches.h1
-rw-r--r--content/test/content_browser_test.cc5
4 files changed, 11 insertions, 2 deletions
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc
index fe91531..5f93fc1 100644
--- a/content/shell/shell_browser_context.cc
+++ b/content/shell/shell_browser_context.cc
@@ -41,7 +41,9 @@ ShellBrowserContext::~ShellBrowserContext() {
}
void ShellBrowserContext::InitWhileIOAllowed() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
+ CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kContentBrowserTest) ||
+ cmd_line->HasSwitch(switches::kDumpRenderTree)) {
CHECK(testing_path_.CreateUniqueTempDir());
path_ = testing_path_.path();
return;
diff --git a/content/shell/shell_switches.cc b/content/shell/shell_switches.cc
index 4a392f5..e3cffb3 100644
--- a/content/shell/shell_switches.cc
+++ b/content/shell/shell_switches.cc
@@ -9,6 +9,9 @@ namespace switches {
// Check whether all system dependencies for running layout tests are met.
const char kCheckLayoutTestSysDeps[] = "check-layout-test-sys-deps";
+// Tells Content Shell that it's running as a content_browsertest.
+const char kContentBrowserTest[] = "browser-test";
+
// Request pages to be dumped as text once they finished loading.
const char kDumpRenderTree[] = "dump-render-tree";
diff --git a/content/shell/shell_switches.h b/content/shell/shell_switches.h
index 0f05b1f3..342cedd 100644
--- a/content/shell/shell_switches.h
+++ b/content/shell/shell_switches.h
@@ -10,6 +10,7 @@
namespace switches {
extern const char kCheckLayoutTestSysDeps[];
+extern const char kContentBrowserTest[];
extern const char kDumpRenderTree[];
} // namespace switches
diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc
index 9eb5c63..a863d65 100644
--- a/content/test/content_browser_test.cc
+++ b/content/test/content_browser_test.cc
@@ -13,6 +13,7 @@
#include "content/public/common/content_switches.h"
#include "content/shell/shell.h"
#include "content/shell/shell_main_delegate.h"
+#include "content/shell/shell_switches.h"
#include "content/test/test_content_client.h"
#if defined(OS_MACOSX)
@@ -38,9 +39,11 @@ void ContentBrowserTest::SetUp() {
shell_main_delegate_.reset(new ShellMainDelegate);
shell_main_delegate_->PreSandboxStartup();
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ command_line->AppendSwitch(switches::kContentBrowserTest);
+
#if defined(OS_MACOSX)
// See InProcessBrowserTest::PrepareTestCommandLine().
- CommandLine* command_line = CommandLine::ForCurrentProcess();
FilePath subprocess_path;
PathService::Get(base::FILE_EXE, &subprocess_path);
subprocess_path = subprocess_path.DirName().DirName();