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

Unified Diff: chrome/browser/ui/webui/options/options_browsertest.js

Issue 646853004: Enable a11y audit for chrome://settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Apply Feedback pt2 Created 6 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
Index: chrome/browser/ui/webui/options/options_browsertest.js
diff --git a/chrome/browser/ui/webui/options/options_browsertest.js b/chrome/browser/ui/webui/options/options_browsertest.js
index a8c6b5898cef1ac1a894fc1a54c5504ba063df71..1e2228649a61fe644d85064f2846c97603f26579 100644
--- a/chrome/browser/ui/webui/options/options_browsertest.js
+++ b/chrome/browser/ui/webui/options/options_browsertest.js
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+GEN_INCLUDE(['options_browsertest_base.js']);
GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"');
/** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users';
@@ -43,24 +44,15 @@ function waitForPopstate(afterFunction) {
function OptionsWebUITest() {}
OptionsWebUITest.prototype = {
- __proto__: testing.Test.prototype,
-
- /** @override */
- accessibilityIssuesAreErrors: true,
-
- /** @override */
- setUp: function() {
- // user-image-stream is a streaming video element used for capturing a
- // user image during OOBE.
- this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions',
- '.user-image-stream');
- },
+ __proto__: OptionsBrowsertestBase.prototype,
/**
* Browse to the options page & call our preLoad().
+ * @override
*/
browsePreload: 'chrome://settings-frame',
+ /** @override */
isAsync: true,
/**
@@ -89,6 +81,24 @@ OptionsWebUITest.prototype = {
},
};
+/**
+ * Wait for all targets to be hidden.
+ * @param {Array<Element>} targets
+ */
+function waitUntilHidden(targets) {
+ function isHidden(el) { return el.hidden; }
+ function ensureTransition(el) { ensureTransitionEndEvent(el, 500); }
+
+ document.addEventListener('webkitTransitionEnd', function f(e) {
+ if (targets.indexOf(e.target) >= 0 && targets.every(isHidden)) {
+ document.removeEventListener(f, 'webkitTransitionEnd');
+ testDone();
+ }
+ });
+
+ targets.forEach(ensureTransition);
+}
+
// Crashes on Mac only. See http://crbug.com/79181
GEN('#if defined(OS_MACOSX)');
GEN('#define MAYBE_testSetBooleanPrefTriggers ' +
@@ -363,10 +373,7 @@ GEN('#endif'); // defined(OS_CHROMEOS)
function OptionsWebUIExtendedTest() {}
OptionsWebUIExtendedTest.prototype = {
- __proto__: testing.Test.prototype,
-
- /** @override */
- browsePreload: 'chrome://settings-frame',
+ __proto__: OptionsWebUITest.prototype,
/** @override */
typedefCppFixture: 'OptionsBrowserTest',
@@ -376,17 +383,6 @@ OptionsWebUIExtendedTest.prototype = {
GEN(' ClearPref("' + SUPERVISED_USERS_PREF + '");');
},
- /** @override */
- isAsync: true,
-
- /** @override */
- setUp: function() {
- // user-image-stream is a streaming video element used for capturing a
- // user image during OOBE.
- this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions',
- '.user-image-stream');
- },
-
/**
* Asserts that two non-nested arrays are equal. The arrays must contain only
* plain data types, no nested arrays or other objects.
@@ -676,7 +672,8 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlay', function() {
self.verifyOpenPages_(['settings'], '');
self.verifyHistory_(
['', 'languages', 'addLanguage', 'languages', ''],
- testDone);
+ function noop() {});
+ waitUntilHidden([$('overlay-container-1'), $('overlay-container-2')]);
});
});
});
@@ -708,7 +705,8 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayWithHashes', function() {
this.verifyHistory_(
['', 'search#1', 'languages#2', 'addLanguage#3', 'languages#2',
'search#1'],
- testDone);
+ function noop() {});
+ waitUntilHidden([$('overlay-container-1'), $('overlay-container-2')]);
}.bind(this));
}.bind(this));
});
@@ -724,7 +722,8 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayNoHistory', function() {
// Close the overlay.
PageManager.closeOverlay();
// Still no history changes.
- this.verifyHistory_([''], testDone);
+ this.verifyHistory_([''], function noop() {});
+ waitUntilHidden([$('overlay-container-1')]);
}.bind(this));
});

Powered by Google App Engine
This is Rietveld 408576698