OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('settings_people_page', function() { | 5 cr.define('settings_people_page', function() { |
6 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @implements {settings.ProfileInfoBrowserProxy} | 8 * @implements {settings.ProfileInfoBrowserProxy} |
9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
10 */ | 10 */ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 | 157 |
158 MockInteractions.tap(disconnectButton); | 158 MockInteractions.tap(disconnectButton); |
159 Polymer.dom.flush(); | 159 Polymer.dom.flush(); |
160 | 160 |
161 assertTrue(peoplePage.$.disconnectDialog.open); | 161 assertTrue(peoplePage.$.disconnectDialog.open); |
162 assertFalse(peoplePage.$.deleteProfile.hidden); | 162 assertFalse(peoplePage.$.deleteProfile.hidden); |
163 | 163 |
164 var disconnectConfirm = peoplePage.$.disconnectConfirm; | 164 var disconnectConfirm = peoplePage.$.disconnectConfirm; |
165 assertTrue(!!disconnectConfirm); | 165 assertTrue(!!disconnectConfirm); |
166 assertFalse(disconnectConfirm.hidden); | 166 assertFalse(disconnectConfirm.hidden); |
167 | |
168 // Wait for exit of dialog route. | |
169 var dialogExitPromise = new Promise(function(resolve) { | |
170 window.addEventListener('popstate', function callback() { | |
michaelpg
2016/08/26 20:56:09
i don't think it actually makes a difference when
tommycli
2016/08/29 22:43:23
I discussed this with Dan. I think we want to be s
| |
171 window.removeEventListener('popstate', callback); | |
172 resolve(browserProxy.whenCalled('signOut')); | |
michaelpg
2016/08/26 20:56:09
so you're resolving this promise with... a promise
tommycli
2016/08/26 20:57:51
Yes my theory was:
Wait for the popstate and also
michaelpg
2016/08/26 21:34:10
I don't think it works like that; passing a promis
tommycli
2016/08/29 22:43:23
Done.
michaelpg
2016/08/30 02:01:40
I lied! It does work like that! O_O
http://jsbin.
| |
173 }); | |
174 }); | |
175 | |
167 MockInteractions.tap(disconnectConfirm); | 176 MockInteractions.tap(disconnectConfirm); |
168 | 177 |
169 return browserProxy.whenCalled('signOut'); | 178 return dialogExitPromise; |
170 }).then(function(deleteProfile) { | 179 }).then(function(deleteProfile) { |
Dan Beam
2016/08/29 18:08:55
/**
* @param {string} eventName
* @param {!Event
tommycli
2016/08/29 18:13:36
Yes I think that would be excellent.
| |
171 Polymer.dom.flush(); | |
172 | |
173 assertFalse(deleteProfile); | 180 assertFalse(deleteProfile); |
michaelpg
2016/08/26 21:34:10
...but then how is this false? browserProxy.whenCa
tommycli
2016/08/29 22:43:23
deleteProfile is an argument of signout. It's only
michaelpg
2016/08/30 02:01:40
yeah, nevermind -- I didn't know that calling reso
| |
174 | 181 |
175 cr.webUIListenerCallback('sync-status-changed', { | 182 cr.webUIListenerCallback('sync-status-changed', { |
176 signedIn: true, | 183 signedIn: true, |
177 domain: 'example.com', | 184 domain: 'example.com', |
178 }); | 185 }); |
179 Polymer.dom.flush(); | 186 Polymer.dom.flush(); |
180 | 187 |
181 assertFalse(peoplePage.$.disconnectDialog.open); | 188 assertFalse(peoplePage.$.disconnectDialog.open); |
182 MockInteractions.tap(disconnectButton); | 189 MockInteractions.tap(disconnectButton); |
183 Polymer.dom.flush(); | 190 Polymer.dom.flush(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 } | 252 } |
246 | 253 |
247 return { | 254 return { |
248 registerTests: function() { | 255 registerTests: function() { |
249 registerProfileInfoTests(); | 256 registerProfileInfoTests(); |
250 if (!cr.isChromeOS) | 257 if (!cr.isChromeOS) |
251 registerSyncStatusTests(); | 258 registerSyncStatusTests(); |
252 }, | 259 }, |
253 }; | 260 }; |
254 }); | 261 }); |
OLD | NEW |