diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:41:35 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 22:41:35 +0000 |
commit | 60a782e6a5a80fbba8fe690f05502147ae998d8c (patch) | |
tree | df4afe3ff4e57fa3d8a1e67e5c0e9634cb72195c | |
parent | 3d8ac4dbf19302e1633509ea1d216765e0f4e44c (diff) | |
download | chromium_src-60a782e6a5a80fbba8fe690f05502147ae998d8c.zip chromium_src-60a782e6a5a80fbba8fe690f05502147ae998d8c.tar.gz chromium_src-60a782e6a5a80fbba8fe690f05502147ae998d8c.tar.bz2 |
Linux: Make sure browser_tests fork()s the helper processes before starting up other threads.
BUG=30501
Review URL: http://codereview.chromium.org/657069
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39941 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index d71a93a..80c0ce9 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -173,6 +173,28 @@ void InProcessBrowserTest::SetUp() { host_resolver_.get()); SetUpInProcessBrowserTestFixture(); + + // Before we run the browser, we have to hack the path to the exe to match + // what it would be if Chrome was running, because it is used to fork renderer + // processes, on Linux at least (failure to do so will cause a browser_test to + // be run instead of a renderer). + FilePath chrome_path; + CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); + chrome_path = chrome_path.DirName(); +#if defined(OS_WIN) + chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); +#elif defined(OS_POSIX) + chrome_path = chrome_path.Append( + WideToASCII(chrome::kBrowserProcessExecutablePath)); +#endif + CHECK(PathService::Override(base::FILE_EXE, chrome_path)); + +#if defined(OS_LINUX) + // Initialize the RenderSandbox and Zygote hosts. Apparently they get used + // for InProcessBrowserTest, and this is not the normal browser startup path. + Singleton<LinuxHostInit>::get(); +#endif + BrowserMain(params); TearDownInProcessBrowserTestFixture(); } @@ -234,32 +256,10 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { return; } - - // Before we run the browser, we have to hack the path to the exe to match - // what it would be if Chrome was running, because it is used to fork renderer - // processes, on Linux at least (failure to do so will cause a browser_test to - // be run instead of a renderer). - FilePath chrome_path; - CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); - chrome_path = chrome_path.DirName(); -#if defined(OS_WIN) - chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); -#elif defined(OS_POSIX) - chrome_path = chrome_path.Append( - WideToASCII(chrome::kBrowserProcessExecutablePath)); -#endif - CHECK(PathService::Override(base::FILE_EXE, chrome_path)); - ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableFunction(chrome_browser_net::SetUrlRequestMocksEnabled, true)); -#if defined(OS_LINUX) - // Initialize the RenderSandbox and Zygote hosts. Apparently they get used - // for InProcessBrowserTest, and this is not the normal browser startup path. - Singleton<LinuxHostInit>::get(); -#endif - browser_ = CreateBrowser(profile); // Start the timeout timer to prevent hangs. |