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

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

Issue 11664011: Add a mechanism to ignore certain elements for accessibility audit on a per-test basis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/js_unittest_vars.gypi ('k') | chrome/test/data/webui/test_api.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/accessibility_audit_browsertest.js
diff --git a/chrome/test/data/webui/accessibility_audit_browsertest.js b/chrome/test/data/webui/accessibility_audit_browsertest.js
index 9af61c0f2980b72c31409f67ac2e0171230116c4..407116159586b7deb137b5ff58ccd9de9a100e3b 100644
--- a/chrome/test/data/webui/accessibility_audit_browsertest.js
+++ b/chrome/test/data/webui/accessibility_audit_browsertest.js
@@ -38,6 +38,9 @@ WebUIAccessibilityAuditBrowserTest.prototype = {
*/
expectedErrors: null,
+ isAsync: false,
+ accessibilityAuditConfig: new axs.AuditConfiguration(),
+
tearDown: function() {
if (this.expectedErrors != null)
expectEquals(this.expectedErrors, this.getAccessibilityErrors().length);
@@ -119,7 +122,7 @@ function expectAuditWillNotRun() {
function expectAuditWillRun(times) {
var audit = createMockAudit();
var realAudit = axs.Audit;
- var expectedInvocation = audit.expects(exactly(times)).run();
+ var expectedInvocation = audit.expects(exactly(times)).run(ANYTHING);
var willArgs = [];
for (var i = 0; i < times; i++)
willArgs.push(callFunction(realAudit.run));
@@ -188,7 +191,6 @@ TEST_F('WebUIAccessibilityAuditBrowserTest_TestsDisabledInFixture',
TEST_F('WebUIAccessibilityAuditBrowserTest_TestsDisabledInFixture',
'testWithAuditFailures_shouldFail',
function() {
- console.log(axs.Audit);
expectAuditWillRun(1);
this.enableAccessibilityChecks();
addAuditFailures();
@@ -282,3 +284,22 @@ TEST_F('WebUIAccessibilityAuditBrowserTest_IssuesAreWarnings',
addAuditFailures();
});
+
+// Tests that the accessibility audit will run twice if expectAccessibilityOk()
dmazzoni 2012/12/21 20:00:35 Update this comment
aboxhall 2012/12/21 23:12:04 Done.
+// is called during the test function and |runAccessibilityChecks| is true in
+// the test fixture.
+TEST_F('WebUIAccessibilityAuditBrowserTest_IssuesAreWarnings',
+ 'testCanIgnoreSelectors',
+ function() {
+ expectAuditWillRun(1);
+ // lowContrastElements should pass as the failing element is ignored.
dmazzoni 2012/12/21 20:00:35 Would it be possible to make this test self-contai
aboxhall 2012/12/21 23:12:04 Done.
+ this.expectedWarnings = 0;
+ this.expectedErrors = 2;
+ expectReportConsoleWarning();
+
+ this.enableAccessibilityChecks();
+
+ this.accessibilityAuditConfig.ignoreSelectors('lowContrastElements', 'P');
+
+ addAuditFailures();
+});
« no previous file with comments | « chrome/js_unittest_vars.gypi ('k') | chrome/test/data/webui/test_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698