diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 18:08:51 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 18:08:51 +0000 |
commit | cb1c03a28c028328632ca668cf81bc310fbcc347 (patch) | |
tree | 7484bc51ed5e0473fd26414d0db48a161e95403c /content/shell | |
parent | 8816b33df3dc07b9811f1556ad339535d5bdf464 (diff) | |
download | chromium_src-cb1c03a28c028328632ca668cf81bc310fbcc347.zip chromium_src-cb1c03a28c028328632ca668cf81bc310fbcc347.tar.gz chromium_src-cb1c03a28c028328632ca668cf81bc310fbcc347.tar.bz2 |
[content shell] when running in layout test mode, create the temp directory used for the browser context outside of the browser context
The directory needs to be still around during the BrowserContext destructor
which runs however, after the ShellBrowserContext destructor.
BUG=111316
R=marja@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11537006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/shell_browser_context.cc | 5 | ||||
-rw-r--r-- | content/shell/shell_browser_context.h | 2 | ||||
-rw-r--r-- | content/shell/shell_browser_main.cc | 16 |
3 files changed, 13 insertions, 10 deletions
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index a36d5e5..9eaa6b2 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -47,11 +47,6 @@ void ShellBrowserContext::InitWhileIOAllowed() { cmd_line->HasSwitch(switches::kDumpRenderTree)) { ignore_certificate_errors_ = true; } - if (cmd_line->HasSwitch(switches::kDumpRenderTree)) { - CHECK(testing_path_.CreateUniqueTempDir()); - path_ = testing_path_.path(); - return; - } if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); return; diff --git a/content/shell/shell_browser_context.h b/content/shell/shell_browser_context.h index 8805e3d..f58132e 100644 --- a/content/shell/shell_browser_context.h +++ b/content/shell/shell_browser_context.h @@ -7,7 +7,6 @@ #include "base/compiler_specific.h" #include "base/file_path.h" -#include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_context.h" @@ -54,7 +53,6 @@ class ShellBrowserContext : public BrowserContext { bool off_the_record_; bool ignore_certificate_errors_; - base::ScopedTempDir testing_path_; FilePath path_; scoped_ptr<ResourceContext> resource_context_; scoped_refptr<ShellDownloadManagerDelegate> download_manager_delegate_; diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index 283617c..9e6deb2 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" +#include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" @@ -93,6 +94,18 @@ bool GetNextTest(const CommandLine::StringVector& args, // Main routine for running as the Browser process. int ShellBrowserMain(const content::MainFunctionParams& parameters) { + bool layout_test_mode = + CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); + base::ScopedTempDir browser_context_path_for_layout_tests; + + if (layout_test_mode) { + CHECK(browser_context_path_for_layout_tests.CreateUniqueTempDir()); + CHECK(!browser_context_path_for_layout_tests.path().MaybeAsASCII().empty()); + CommandLine::ForCurrentProcess()->AppendSwitchASCII( + switches::kContentShellDataPath, + browser_context_path_for_layout_tests.path().MaybeAsASCII()); + } + scoped_ptr<content::BrowserMainRunner> main_runner_( content::BrowserMainRunner::Create()); @@ -109,9 +122,6 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) { return 0; } - bool layout_test_mode = - CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); - if (layout_test_mode) { content::WebKitTestController test_controller; std::string test_string; |