diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 16:05:05 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 16:05:05 +0000 |
commit | a4557704b0d7219caef75015629652b6c869f12a (patch) | |
tree | 5a542bdc3bf777fe23ea67ae14ac4a42a192aa07 /chrome/test/browser | |
parent | 68b1e92848aebead28f92118e698a1b644d6f572 (diff) | |
download | chromium_src-a4557704b0d7219caef75015629652b6c869f12a.zip chromium_src-a4557704b0d7219caef75015629652b6c869f12a.tar.gz chromium_src-a4557704b0d7219caef75015629652b6c869f12a.tar.bz2 |
This CL makes the browser_tests.exe runnable from outside its directory.
BUG=None
TEST=Run browser_tests.exe from the command line from a directory that is not the directory containing it.
Review URL: http://codereview.chromium.org/146018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/browser')
-rw-r--r-- | chrome/test/browser/browser_test_launcher_in_proc.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/chrome/test/browser/browser_test_launcher_in_proc.cc b/chrome/test/browser/browser_test_launcher_in_proc.cc index a93d095..ed2a473 100644 --- a/chrome/test/browser/browser_test_launcher_in_proc.cc +++ b/chrome/test/browser/browser_test_launcher_in_proc.cc @@ -10,6 +10,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/native_library.h" +#include "base/path_service.h" #include "base/process_util.h" #include "base/string_util.h" @@ -40,22 +41,15 @@ class InProcBrowserTestRunner : public browser_tests::BrowserTestRunner { bool Init() { FilePath lib_path; - if (!file_util::GetCurrentDirectory(&lib_path)) { - LOG(ERROR) << "Failed to retrieve curret directory."; - return false; - } + CHECK(PathService::Get(base::FILE_EXE, &lib_path)); + lib_path = lib_path.DirName().Append( + base::GetNativeLibraryName(kBrowserTesLibBaseName)); - string16 lib_name = base::GetNativeLibraryName(kBrowserTesLibBaseName); -#if defined(OS_WIN) - lib_path = lib_path.Append(lib_name); -#else - lib_path = lib_path.Append(WideToUTF8(lib_name)); -#endif LOG(INFO) << "Loading '" << lib_path.value() << "'"; dynamic_lib_ = base::LoadNativeLibrary(lib_path); if (!dynamic_lib_) { - LOG(ERROR) << "Failed to find " << lib_name; + LOG(ERROR) << "Failed to load " << lib_path.value(); return false; } @@ -63,7 +57,7 @@ class InProcBrowserTestRunner : public browser_tests::BrowserTestRunner { base::GetFunctionPointerFromNativeLibrary(dynamic_lib_, "RunTests")); if (!run_test_proc_) { LOG(ERROR) << - "Failed to find RunTest function in " << lib_name; + "Failed to find RunTest function in " << lib_path.value(); return false; } |