Chromium Code Reviews| Index: chrome/browser/ui/webui/web_ui_browsertest.cc |
| diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc |
| index 133bd14bcd56c208cc2ef3a849d22d14e7e70c4e..ec57a4f737857163e5c6b5be10d8c9b4e5d85bb3 100644 |
| --- a/chrome/browser/ui/webui/web_ui_browsertest.cc |
| +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc |
| @@ -46,7 +46,10 @@ using content::WebUIMessageHandler; |
| namespace { |
| +const std::string kMockJSPath = "chrome/third_party/mock4js/mock4js.js"; |
|
Sheridan Rawlins
2012/12/18 01:43:35
Why aren't these also FILE_PATH_LITERALs?
|
| const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js"); |
| +const std::string kA11yAuditLibraryJSPath = |
| + "third_party/accessibility-developer-tools/gen/axs_testing.js"; |
| const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js"); |
| const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui"); |
| base::LazyInstance<std::vector<std::string> > error_messages_ = |
| @@ -75,6 +78,13 @@ void WebUIBrowserTest::AddLibrary(const FilePath& library_path) { |
| user_libraries_.push_back(library_path); |
| } |
| +void WebUIBrowserTest::AddLibraryFromUTFPath(const std::string path) { |
| + FilePath filePath; |
| + ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &filePath)); |
| + filePath = filePath.Append(FilePath::FromUTF8Unsafe(path)); |
| + AddLibrary(filePath); |
| +} |
| + |
| bool WebUIBrowserTest::RunJavascriptFunction(const std::string& function_name) { |
| ConstValueVector empty_args; |
| return RunJavascriptFunction(function_name, empty_args); |
| @@ -330,17 +340,13 @@ void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { |
| ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| resources_pack_path, ui::SCALE_FACTOR_NONE); |
| - FilePath mockPath; |
| - ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &mockPath)); |
| - mockPath = mockPath.AppendASCII("chrome"); |
| - mockPath = mockPath.AppendASCII("third_party"); |
| - mockPath = mockPath.AppendASCII("mock4js"); |
| - mockPath = mockPath.Append(kMockJS); |
| - AddLibrary(mockPath); |
| + AddLibraryFromUTFPath(kMockJSPath); |
| AddLibrary(FilePath(kWebUILibraryJS)); |
| + AddLibraryFromUTFPath(kA11yAuditLibraryJSPath); |
| } |
| void WebUIBrowserTest::TearDownInProcessBrowserTestFixture() { |
| +// EXPECT_TRUE(RunJavascriptTest("runAccessibilityAudit")); |
| InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); |
| TestChromeWebUIControllerFactory::RemoveFactoryOverride( |
| GURL(kDummyURL).host()); |