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

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

Issue 11363170: Add an accessibility audit test for WebUI pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving accessibility-developer-tools to src/third_party Created 8 years, 1 month 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
« chrome/test/base/js2gtest.js ('K') | « chrome/test/base/js2gtest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/test_api.js
diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js
index 03c6721d51d55bf0baf4641caa2e6d9955c31802..299cfaa679d1b26056e2fe62a2a6b92746295b2e 100644
--- a/chrome/test/data/webui/test_api.js
+++ b/chrome/test/data/webui/test_api.js
@@ -221,6 +221,25 @@ var testing = {};
currentTestCase, [whenTestDone].concat(
Array.prototype.slice.call(arguments, 1)));
},
+
+ /**
+ * Run an accessibility audit on the current page state.
+ * @type {Function}
+ */
+ runAccessibilityAudit: function() {
+ for (var auditRuleName in axs.AuditRule.specs) {
+ var auditRule = axs.AuditRules.getRule(auditRuleName);
+ if (!auditRule)
+ continue; // Shouldn't happen, but fail silently if it does.
+ if (!auditRule.disabled && !auditRule.requiresConsoleAPI) {
+ var result = auditRule.run();
+ expectTrue(result.result == axs.constants.AuditResult.PASS ||
+ result.result == axs.constants.AuditResult.NA,
+ "Accessibility audit rule " + auditRule.name + " failed");
+ }
+ }
+ testDone();
+ }
};
/**
@@ -619,7 +638,8 @@ var testing = {};
currentTestCase = null;
}
chrome.send('testResult', result ? result : testResult());
- errors.splice(0, errors.length);
+// errors.splice(0, errors.length);
+ resetTestState();
} else {
console.warn('testIsDone already');
}
@@ -984,8 +1004,11 @@ var testing = {};
var fixtureConstructor = this[testFixture];
if (!fixtureConstructor.prototype.name)
fixtureConstructor.prototype.name = testFixture;
- if (fixtureConstructor['testCaseBodies'] === undefined)
+ if (fixtureConstructor['testCaseBodies'] === undefined) {
fixtureConstructor.testCaseBodies = {};
+ fixtureConstructor.testCaseBodies["accessibilityAudit"] =
+ Test.prototype.runAccessibilityAudit;
+ }
fixtureConstructor.testCaseBodies[testName] = testBody;
}
« chrome/test/base/js2gtest.js ('K') | « chrome/test/base/js2gtest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698