Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4066)

Unified Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 11363170: Add an accessibility audit test for WebUI pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sheridan's patch and order change for imports in web_ui_browsertest Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9ae134fa44e323ad8c6da57dc2beda7e92d1b0fc..9d82e02983cdbae6586edc34aba2065688941382 100644
--- a/chrome/browser/ui/webui/web_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/web_ui_browsertest.cc
@@ -45,6 +45,10 @@ using content::WebUIMessageHandler;
namespace {
+const FilePath::CharType kA11yAuditLibraryJSPath[] = FILE_PATH_LITERAL(
+ "third_party/accessibility-developer-tools/gen/axs_testing.js");
+const FilePath::CharType kMockJSPath[] =
+ FILE_PATH_LITERAL("chrome/third_party/mock4js/mock4js.js");
const FilePath::CharType kMockJS[] = FILE_PATH_LITERAL("mock4js.js");
const FilePath::CharType kWebUILibraryJS[] = FILE_PATH_LITERAL("test_api.js");
const FilePath::CharType kWebUITestFolder[] = FILE_PATH_LITERAL("webui");
@@ -74,6 +78,13 @@ void WebUIBrowserTest::AddLibrary(const FilePath& library_path) {
user_libraries_.push_back(library_path);
}
+void WebUIBrowserTest::AddLibraryFromPath(const FilePath& path) {
+ FilePath filePath;
+ ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &filePath));
+ filePath = filePath.Append(path);
+ AddLibrary(filePath);
+}
+
bool WebUIBrowserTest::RunJavascriptFunction(const std::string& function_name) {
ConstValueVector empty_args;
return RunJavascriptFunction(function_name, empty_args);
@@ -329,13 +340,8 @@ 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);
+ AddLibraryFromPath(FilePath(kA11yAuditLibraryJSPath));
+ AddLibraryFromPath(FilePath(kMockJSPath));
AddLibrary(FilePath(kWebUILibraryJS));
}

Powered by Google App Engine
This is Rietveld 408576698