diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 17:29:09 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-25 17:29:09 +0000 |
commit | eca6a4f5c6194885dee51b9d5ffc978ef18acf51 (patch) | |
tree | 3e3ca28631e45d3094f064b9493008871a927fdb | |
parent | 55185493afba3b7813d44a25c614975c0bc0f32b (diff) | |
download | chromium_src-eca6a4f5c6194885dee51b9d5ffc978ef18acf51.zip chromium_src-eca6a4f5c6194885dee51b9d5ffc978ef18acf51.tar.gz chromium_src-eca6a4f5c6194885dee51b9d5ffc978ef18acf51.tar.bz2 |
On Linux, the path to the exe is used to fork renderer processes.
This was causing the browser tests to create browser tests instead of a renderer processes.
Also the SSL tests now pass on Linux and have been enabled.
BUG=None
TEST=Run the browser tests on Linux.
Review URL: http://codereview.chromium.org/146057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19257 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/path_service.cc | 15 | ||||
-rw-r--r-- | base/path_service.h | 3 | ||||
-rw-r--r-- | chrome/browser/ssl/ssl_browser_tests.cc | 15 | ||||
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 16 |
4 files changed, 28 insertions, 21 deletions
diff --git a/base/path_service.cc b/base/path_service.cc index f625c98..3e34892 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -206,12 +206,12 @@ bool PathService::IsOverridden(int key) { return path_data->overrides.find(key) != path_data->overrides.end(); } -bool PathService::Override(int key, const std::wstring& path) { +bool PathService::Override(int key, const FilePath& path) { PathData* path_data = GetPathData(); DCHECK(path_data); DCHECK(key > base::DIR_CURRENT) << "invalid path key"; - std::wstring file_path = path; + FilePath file_path = path; #if defined(OS_WIN) // On Windows we switch the current working directory to load plugins (at // least). That's not the case on POSIX. @@ -221,17 +221,20 @@ bool PathService::Override(int key, const std::wstring& path) { #endif // make sure the directory exists: - if (!file_util::CreateDirectory(file_path)) + if (!file_util::PathExists(file_path) && + !file_util::CreateDirectory(file_path)) return false; - file_util::TrimTrailingSeparator(&file_path); - AutoLock scoped_lock(path_data->lock); - path_data->cache[key] = FilePath::FromWStringHack(file_path); + path_data->cache[key] = file_path; path_data->overrides.insert(key); return true; } +bool PathService::Override(int key, const std::wstring& path) { + return Override(key, FilePath::FromWStringHack(path)); +} + bool PathService::SetCurrentDirectory(const std::wstring& current_directory) { return file_util::SetCurrentDirectory(current_directory); } diff --git a/base/path_service.h b/base/path_service.h index 54d7ade..9cd0889 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -48,6 +48,9 @@ class PathService { // // WARNING: Consumers of PathService::Get may expect paths to be constant // over the lifetime of the app, so this method should be used with caution. + static bool Override(int key, const FilePath& path); + // This version, using a wstring, is deprecated and only kept around + // until we can fix all callers. static bool Override(int key, const std::wstring& path); // Return whether a path was overridden. diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 8f0eb49..304b16a 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -73,7 +73,6 @@ class SSLUITest : public InProcessBrowserTest { DISALLOW_COPY_AND_ASSIGN(SSLUITest); }; -#if defined(OS_WIN) // Visits a regular page over http. IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { scoped_refptr<HTTPTestServer> server = PlainServer(); @@ -712,20 +711,6 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnauthenticatedFrameNavigation) { content_frame_xpath, is_frame_evil_js, &is_content_evil)); EXPECT_FALSE(is_content_evil); } -#else -// TODO(port): enable the real tests. -IN_PROC_BROWSER_TEST_F(SSLUITest, PhonyTest1) { - EXPECT_TRUE(true); -} - -IN_PROC_BROWSER_TEST_F(SSLUITest, PhonyTest2) { - EXPECT_TRUE(false); -} - -IN_PROC_BROWSER_TEST_F(SSLUITest, PhonyTest3) { - EXPECT_TRUE(true); -} -#endif // TODO(jcampan): more tests to do below. diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 75a9c2d..64007de 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -187,6 +187,22 @@ 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)); + browser_ = CreateBrowser(profile); RunTestOnMainThread(); |