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..ad36295570983d14eec78c4f424da4ad8d74536c 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,41 @@ OptionsWebUITest.prototype = { |
| }, |
| }; |
| +/** |
| + * Wait for overlay-container-1 to be hidden. |
| + */ |
| +function waitForSingleOverlayToHide() { |
| + var overlay1 = $('overlay-container-1'); |
| + |
| + document.addEventListener('webkitTransitionEnd', function f(e) { |
| + if (e.target.id == overlay1.id && overlay1.hidden) { |
| + document.removeEventListener(f, 'webkitTransitionEnd'); |
| + testDone(); |
| + } |
| + }); |
| + |
| + ensureTransitionEndEvent(overlay1, 500); |
| +} |
| + |
| +/** |
| + * Wait for overlay-container-1 and overlay-container-2 to be hidden. |
| + */ |
| +function waitForBothOverlaysToHide() { |
| + var overlay1 = $('overlay-container-1'); |
| + var overlay2 = $('overlay-container-2'); |
| + |
| + document.addEventListener('webkitTransitionEnd', function f(e) { |
| + if ((e.target.id == overlay1.id || e.target.id == overlay2.id) && |
| + overlay1.hidden && overlay2.hidden) { |
| + document.removeEventListener(f, 'webkitTransitionEnd'); |
| + testDone(); |
| + } |
| + }); |
| + |
| + ensureTransitionEndEvent(overlay1, 500); |
| + ensureTransitionEndEvent(overlay2, 500); |
| +} |
|
Dan Beam
2014/12/03 00:55:22
dedupe the cotents of these 2 methods, e.g.:
/**
Dan Beam
2014/12/03 00:55:42
contents
hcarmona
2014/12/04 00:12:34
Done.
|
| + |
| // Crashes on Mac only. See http://crbug.com/79181 |
| GEN('#if defined(OS_MACOSX)'); |
| GEN('#define MAYBE_testSetBooleanPrefTriggers ' + |
| @@ -363,10 +390,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 +400,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 +689,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlay', function() { |
| self.verifyOpenPages_(['settings'], ''); |
| self.verifyHistory_( |
| ['', 'languages', 'addLanguage', 'languages', ''], |
| - testDone); |
| + waitForBothOverlaysToHide); |
| }); |
| }); |
| }); |
| @@ -708,7 +721,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayWithHashes', function() { |
| this.verifyHistory_( |
| ['', 'search#1', 'languages#2', 'addLanguage#3', 'languages#2', |
| 'search#1'], |
| - testDone); |
| + waitForBothOverlaysToHide); |
| }.bind(this)); |
| }.bind(this)); |
| }); |
| @@ -724,7 +737,7 @@ TEST_F('OptionsWebUIExtendedTest', 'CloseOverlayNoHistory', function() { |
| // Close the overlay. |
| PageManager.closeOverlay(); |
| // Still no history changes. |
| - this.verifyHistory_([''], testDone); |
| + this.verifyHistory_([''], waitForSingleOverlayToHide); |
| }.bind(this)); |
| }); |