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

Unified Diff: chrome/test/data/webui/settings/reset_page_test.js

Issue 2130023002: MD Settings: Reset page, fix dialog test that was erroneously passing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/settings/reset_page_test.js
diff --git a/chrome/test/data/webui/settings/reset_page_test.js b/chrome/test/data/webui/settings/reset_page_test.js
index 8b6b8c092e5000a3a8c58f5ce3866ca238e9cb48..befb90e9623d9670ef0d1bd62fcba99f2d83714f 100644
--- a/chrome/test/data/webui/settings/reset_page_test.js
+++ b/chrome/test/data/webui/settings/reset_page_test.js
@@ -151,43 +151,51 @@ cr.define('settings_reset_page', function() {
MockInteractions.tap(resetPage.$.resetProfile);
var dialog = resetPage.$$('settings-reset-profile-dialog');
assertTrue(!!dialog);
+ assertTrue(dialog.$.dialog.opened);
var onDialogClosed = new Promise(
function(resolve, reject) {
- dialog.addEventListener('iron-overlay-closed', resolve);
+ dialog.addEventListener('iron-overlay-closed', function() {
+ assertFalse(dialog.$.dialog.opened);
+ resolve();
+ });
});
- return resetPageBrowserProxy.whenCalled(
- 'onShowResetProfileDialog').then(
- function() {
+ return new Promise(function(resolve, reject) {
+ resetPageBrowserProxy.whenCalled(
+ 'onShowResetProfileDialog').then(function() {
+ // Need to call requestAnimationFrame here, otherwise the dialog has
+ // not been registered to the IronOverlayManager at the time we
+ // attempt to close it (which prevents closing by 'esc' key from
+ // working).
+ window.requestAnimationFrame(function() {
closeDialogFn(dialog);
- return Promise.all([
+ Promise.all([
onDialogClosed,
resetPageBrowserProxy.whenCalled('onHideResetProfileDialog'),
- ]);
+ ]).then(resolve, reject);
});
+ });
+ });
}
// Tests that the reset profile dialog opens and closes correctly and that
// resetPageBrowserProxy calls are occurring as expected.
test(TestNames.ResetProfileDialogOpenClose, function() {
- return Promise.all([
+ return testOpenCloseResetProfileDialog(function(dialog) {
// Test case where the 'cancel' button is clicked.
- testOpenCloseResetProfileDialog(
- function(dialog) {
- MockInteractions.tap(dialog.$.cancel);
- }),
- // Test case where the 'close' button is clicked.
- testOpenCloseResetProfileDialog(
- function(dialog) {
- MockInteractions.tap(dialog.$.dialog.getCloseButton());
- }),
- // Test case where the 'Esc' key is pressed.
- testOpenCloseResetProfileDialog(
- function(dialog) {
- MockInteractions.pressAndReleaseKeyOn(
- dialog, 27 /* 'Esc' key code */);
- }),
- ]);
+ MockInteractions.tap(dialog.$.cancel);
+ }).then(function() {
+ return testOpenCloseResetProfileDialog(function(dialog) {
+ // Test case where the 'close' button is clicked.
+ MockInteractions.tap(dialog.$.dialog.getCloseButton());
+ });
+ }).then(function() {
+ return testOpenCloseResetProfileDialog(function(dialog) {
+ // Test case where the 'Esc' key is pressed.
+ MockInteractions.pressAndReleaseKeyOn(
+ dialog, 27 /* 'Esc' key code */);
+ });
+ });
});
// Tests that when user request to reset the profile the appropriate
« 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