Chromium Code Reviews| 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(); |
|
Sheridan Rawlins
2012/11/29 17:43:48
I think that explicitly having TEST_F would also r
aboxhall
2012/11/30 00:56:27
As per my other comment, I don't completely unders
|
| } 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; |
| } |