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

Unified Diff: chrome/test/data/webui/a11y_audit_browsertest.js

Issue 11363170: Add an accessibility audit test for WebUI pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added some test cases for the test test 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/test/data/webui/a11y_audit_browsertest.js
diff --git a/chrome/test/data/webui/a11y_audit_browsertest.js b/chrome/test/data/webui/a11y_audit_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..03952fe86d48b878130e4439e8cf4a1b2d87d8d2
--- /dev/null
+++ b/chrome/test/data/webui/a11y_audit_browsertest.js
@@ -0,0 +1,76 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function WebUIA11yAuditBrowserTest() {}
+
+WebUIA11yAuditBrowserTest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ browsePreload: 'chrome://terms',
+
+ runA11yChecks: true,
+ a11yIssuesAreErrors: true,
+};
+
+function addAuditFailures() {
+ var style = document.createElement('style');
+ style.innerText = 'p { color: #ffffff }';
+ document.head.appendChild(style);
+}
+
+function expectAuditWillNotRun() {
+ axs.AuditRule.prototype.run = function() {
+ assertTrue(false, 'AuditRule.run should not be executed');
+ };
+}
+
+RUNTIME_TEST_F('WebUIA11yAuditBrowserTest', 'testWithAuditFailures', function() {
+ addAuditFailures();
+});
+
+RUNTIME_TEST_F('WebUIA11yAuditBrowserTest',
+ 'testWithAuditFailures_a11yChecksDisabled',
+ function() {
+ expectAuditWillNotRun();
+ disableA11yChecks();
+ a11yIssuesAreErrors(false);
+ addAuditFailures();
+});
+
+function WebUIA11yAuditBrowserTest_TestsDisabledInFixture() {}
+
+WebUIA11yAuditBrowserTest_TestsDisabledInFixture.prototype = {
+ __proto__: WebUIA11yAuditBrowserTest.prototype,
+
+ runA11yChecks: false,
+};
+
+RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_TestsDisabledInFixture',
+ 'testWithAuditFailures',
+ function() {
+ enableA11yChecks();
+ addAuditFailures();
+});
+
+RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_TestsDisabledInFixture',
+ 'testWithAuditFailures_a11yChecksNotEnabled',
+ function() {
+ expectAuditWillNotRun();
+ addAuditFailures();
+});
+
+function WebUIA11yAuditBrowserTest_IssuesAreWarnings() {}
+
+WebUIA11yAuditBrowserTest_IssuesAreWarnings.prototype = {
+ __proto__: WebUIA11yAuditBrowserTest.prototype,
+
+ runA11yChecks: false,
+};
+
+RUNTIME_TEST_F('WebUIA11yAuditBrowserTest_IssuesAreWarnings',
+ 'testWithAuditFailures',
+ function() {
+ enableA11yChecks();
+ addAuditFailures();
+});

Powered by Google App Engine
This is Rietveld 408576698