Chromium Code Reviews| 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..c1309220bbca4da484324eb66c4b8fe799c048cc 100644 |
| --- a/chrome/browser/ui/webui/options/options_browsertest.js |
| +++ b/chrome/browser/ui/webui/options/options_browsertest.js |
| @@ -46,6 +46,9 @@ OptionsWebUITest.prototype = { |
| __proto__: testing.Test.prototype, |
| /** @override */ |
| + runAccessibilityChecks: true, |
| + |
| + /** @override */ |
| accessibilityIssuesAreErrors: true, |
| /** @override */ |
| @@ -58,9 +61,11 @@ OptionsWebUITest.prototype = { |
| /** |
| * Browse to the options page & call our preLoad(). |
| + * @override |
| */ |
| browsePreload: 'chrome://settings-frame', |
| + /** @override */ |
| isAsync: true, |
| /** |
| @@ -89,6 +94,49 @@ OptionsWebUITest.prototype = { |
| }, |
| }; |
| +/** |
| + * Wait for overlay-container-1 and overlay-container-2 to be hidden. |
| + */ |
| +function waitForOverlaysToHide() { |
| + var overlayCount = 0; |
| + |
| + /** |
| + * Finsh the test once all overlays that were visible are hidden. |
| + */ |
| + function transitionEndOverlayHidden() { |
| + if (--overlayCount == 0) { |
|
Dan Beam
2014/11/07 05:43:20
no curlies
|
| + testDone(); |
| + } |
| + } |
| + |
| + /** |
| + * Wait for an overlay to hide and do nothing if it's already hidden. |
| + * @param {string} overlayId is the element id of the overlay to watch. |
| + */ |
| + function waitForTransitionEnd(overlayId) { |
|
Dan Beam
2014/11/07 05:43:20
this generally seems a bit much for 2 overlays...
|
| + var overlay = $(overlayId); |
| + |
| + if (!overlayId.hidden) { |
| + ++overlayCount; |
| + document.addEventListener('webkitTransitionEnd', function f(e) { |
| + if (e.target.id == overlayId) { |
| + if (overlay.hidden) { |
|
Dan Beam
2014/11/07 05:43:20
nit:
if (!(e.target.id == overlayId && overlay.
|
| + document.removeEventListener(f, 'webkitTransitionEnd'); |
| + transitionEndOverlayHidden(); |
| + } |
| + } |
| + }); |
| + |
| + // Make sure that there is a transition end event. The overlays will not |
| + // be set as hidden Withouth an end transition. |
| + ensureTransitionEndEvent(overlay, 500); |
| + } |
| + } |
| + |
| + waitForTransitionEnd('overlay-container-1'); |
| + waitForTransitionEnd('overlay-container-2'); |
| +} |
| + |
| // Crashes on Mac only. See http://crbug.com/79181 |
| GEN('#if defined(OS_MACOSX)'); |
| GEN('#define MAYBE_testSetBooleanPrefTriggers ' + |
| @@ -363,10 +411,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 +421,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 +710,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlay', function() { |
| self.verifyOpenPages_(['settings'], ''); |
| self.verifyHistory_( |
| ['', 'languages', 'addLanguage', 'languages', ''], |
| - testDone); |
| + waitForOverlaysToHide); |
| }); |
| }); |
| }); |
| @@ -708,7 +742,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayWithHashes', function() { |
| this.verifyHistory_( |
| ['', 'search#1', 'languages#2', 'addLanguage#3', 'languages#2', |
| 'search#1'], |
| - testDone); |
| + waitForOverlaysToHide); |
| }.bind(this)); |
| }.bind(this)); |
| }); |
| @@ -724,7 +758,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayNoHistory', function() { |
| // Close the overlay. |
| PageManager.closeOverlay(); |
| // Still no history changes. |
| - this.verifyHistory_([''], testDone); |
| + this.verifyHistory_([''], waitForOverlaysToHide); |
| }.bind(this)); |
| }); |