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'); |
+ } |
}, |
/** |