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(); |
+}); |