diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 14:54:09 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-29 14:54:09 +0000 |
commit | f19a218851c01749340806ed9be59135cfced928 (patch) | |
tree | 8a52d9b5ea98a53d57938ad3c94e07d3c0a23bba /content/browser | |
parent | 0203c4fcc60f4111fc7476ff2af4fa12177b600d (diff) | |
download | chromium_src-f19a218851c01749340806ed9be59135cfced928.zip chromium_src-f19a218851c01749340806ed9be59135cfced928.tar.gz chromium_src-f19a218851c01749340806ed9be59135cfced928.tar.bz2 |
Fix last two failing browser tests on Chrome OS
The bidi checker test was using a bad path to locate the js file, fixed that to always find it relative to src root (there is a corresponding CL on Chromium OS to fix the e-build to copy the js over to the test deps).
The plugin test was failing for two reasons, one the plugin not being available (again, corresponding CL on chromium-os tracker to fix that in the e-build), second is Chrome being symlinked. I am not completely sure why this breaks this test, but the executable being in the same directory as the rest of the test files is a more accurate test environment anyway, hence copying it instead of symlinking.
R=zelidrag@chromium.org
BUG=chromium-os:13857
TEST=Ran the full browsertest suite, all passed
Review URL: http://codereview.chromium.org/6904073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/webui/web_ui_bidi_checker_browsertest.cc | 17 | ||||
-rw-r--r-- | content/browser/webui/web_ui_browsertest.cc | 19 | ||||
-rw-r--r-- | content/browser/webui/web_ui_browsertest.h | 4 |
3 files changed, 28 insertions, 12 deletions
diff --git a/content/browser/webui/web_ui_bidi_checker_browsertest.cc b/content/browser/webui/web_ui_bidi_checker_browsertest.cc index 9721838..938a5a5 100644 --- a/content/browser/webui/web_ui_bidi_checker_browsertest.cc +++ b/content/browser/webui/web_ui_bidi_checker_browsertest.cc @@ -4,14 +4,23 @@ #include "content/browser/webui/web_ui_bidi_checker_browsertest.h" +#include "base/base_paths.h" #include "base/path_service.h" #include "chrome/common/url_constants.h" #include "chrome/test/ui_test_utils.h" #include "googleurl/src/gurl.h" static const FilePath::CharType* kWebUIBidiCheckerLibraryJS = - FILE_PATH_LITERAL( - "../../../../third_party/bidichecker/bidichecker_packaged.js"); + FILE_PATH_LITERAL("third_party/bidichecker/bidichecker_packaged.js"); + +namespace { +FilePath WebUIBidiCheckerLibraryJSPath() { + FilePath src_root; + if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_root)) + LOG(ERROR) << "Couldn't find source root"; + return src_root.Append(kWebUIBidiCheckerLibraryJS); +} +} WebUIBidiCheckerBrowserTest::~WebUIBidiCheckerBrowserTest() {} @@ -19,11 +28,11 @@ WebUIBidiCheckerBrowserTest::WebUIBidiCheckerBrowserTest() {} void WebUIBidiCheckerBrowserTest::SetUpInProcessBrowserTestFixture() { WebUIBrowserTest::SetUpInProcessBrowserTestFixture(); - WebUIBrowserTest::AddLibrary(kWebUIBidiCheckerLibraryJS); + WebUIBrowserTest::AddLibrary(WebUIBidiCheckerLibraryJSPath()); } IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTest, TestMainHistoryPageLTR) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL)); - AddLibrary(FILE_PATH_LITERAL("bidichecker_tests.js")); + AddLibrary(FilePath(FILE_PATH_LITERAL("bidichecker_tests.js"))); ASSERT_TRUE(RunJavascriptTest("runBidiCheckerLTR")); } diff --git a/content/browser/webui/web_ui_browsertest.cc b/content/browser/webui/web_ui_browsertest.cc index 654b29b..36c9cc7 100644 --- a/content/browser/webui/web_ui_browsertest.cc +++ b/content/browser/webui/web_ui_browsertest.cc @@ -102,7 +102,7 @@ void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); - AddLibrary(kWebUILibraryJS); + AddLibrary(FilePath(kWebUILibraryJS)); } WebUIMessageHandler* WebUIBrowserTest::GetMockMessageHandler() { @@ -117,9 +117,14 @@ void WebUIBrowserTest::BuildJavascriptLibraries(std::string* content) { for (user_libraries_iterator = user_libraries.begin(); user_libraries_iterator != user_libraries.end(); ++user_libraries_iterator) { - ASSERT_TRUE(file_util::ReadFileToString( - test_data_directory_.Append(*user_libraries_iterator), - &library_content)); + if (user_libraries_iterator->IsAbsolute()) { + ASSERT_TRUE(file_util::ReadFileToString(*user_libraries_iterator, + &library_content)); + } else { + ASSERT_TRUE(file_util::ReadFileToString( + test_data_directory_.Append(*user_libraries_iterator), + &library_content)); + } content->append(library_content); content->append(";\n"); } @@ -183,12 +188,12 @@ void WebUIBrowserTest::SetupHandlers() { GetMockMessageHandler()->Attach(web_ui_instance); } -void WebUIBrowserTest::AddLibrary(const FilePath::CharType* library_path) { - user_libraries.push_back(FilePath(library_path)); +void WebUIBrowserTest::AddLibrary(const FilePath& library_path) { + user_libraries.push_back(library_path); } IN_PROC_BROWSER_TEST_F(WebUIBrowserTest, TestSamplePass) { - AddLibrary(FILE_PATH_LITERAL("sample_downloads.js")); + AddLibrary(FilePath(FILE_PATH_LITERAL("sample_downloads.js"))); // Navigate to UI. // TODO(dtseng): make accessor for subclasses to return? diff --git a/content/browser/webui/web_ui_browsertest.h b/content/browser/webui/web_ui_browsertest.h index 5569cdc..71c91a1 100644 --- a/content/browser/webui/web_ui_browsertest.h +++ b/content/browser/webui/web_ui_browsertest.h @@ -27,7 +27,9 @@ class WebUIBrowserTest : public InProcessBrowserTest { virtual ~WebUIBrowserTest(); // Add a custom helper JS library for your test. - void AddLibrary(const FilePath::CharType* library_path); + // If a relative path is specified, it'll be read + // as relative to the test data dir. + void AddLibrary(const FilePath& library_path); // Runs a javascript function in the context of all libraries. // Note that calls to functions in test_api.js are not supported. |