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

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

Issue 927083003: Fix a failure in test_api.js when accessibility auditing is not enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: window is not available in the jsunit environment, use goog.global. Created 5 years, 10 months 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 | « no previous file | 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 abd27ae3826b49aeef251ea653209b42d13ba840..be8664310a231be58f9744c91e67ac0f509155e3 100644
--- a/chrome/test/data/webui/test_api.js
+++ b/chrome/test/data/webui/test_api.js
@@ -150,7 +150,12 @@ var testing = {};
* @return {axs.AuditConfiguration}
*/
get accessibilityAuditConfig() {
- if (!this.accessibilityAuditConfig_) {
+ // The axs namespace is not available in chromevox tests.
+ // Further, 'window' is not available in unit tests, but since the
+ // accessibility audit library pulls in the closure library,
+ // 'goog.global' has to be present if axs is, so we use that here.
+ if (!this.accessibilityAuditConfig_ &&
+ goog && goog.global && goog.global.axs) {
this.accessibilityAuditConfig_ = new axs.AuditConfiguration();
this.accessibilityAuditConfig_.showUnsupportedRulesWarning = false;
@@ -281,14 +286,17 @@ var testing = {};
* @type {Function}
*/
setUp: function() {
- // These should be ignored in many of the web UI tests.
- // user-image-stream and supervised-user-creation-image-stream are
- // streaming video elements used for capturing a user image so they won't
- // have captions and should be ignored everywhere.
- this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions',
- '.user-image-stream');
- this.accessibilityAuditConfig.ignoreSelectors(
- 'videoWithoutCaptions', '.supervised-user-creation-image-stream');
+ var auditConfig = this.accessibilityAuditConfig;
+ if (auditConfig) {
+ // These should be ignored in many of the web UI tests.
+ // user-image-stream and supervised-user-creation-image-stream are
+ // streaming video elements used for capturing a user image so they
+ // won't have captions and should be ignored everywhere.
+ auditConfig.ignoreSelectors('videoWithoutCaptions',
+ '.user-image-stream');
+ auditConfig.ignoreSelectors(
+ 'videoWithoutCaptions', '.supervised-user-creation-image-stream');
+ }
},
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698