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
Esse commit está contido em:
jcampan@chromium.org
2009-06-25 17:29:09 +00:00
commit c39c5cdb71
4 arquivos alterados com 28 adições e 21 exclusões
+9 -6
Ver Arquivo
@@ -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);
}
+3
Ver Arquivo
@@ -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.
-15
Ver Arquivo
@@ -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.
+16
Ver Arquivo
@@ -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();