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

Side by Side Diff: chrome/test/data/webui/settings/people_page_test.js

Issue 2498013003: MD Settings: Suppress the signout dialog if user is not signed in. (Closed)
Patch Set: solve flakiness Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/people_page/people_page.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 MockInteractions.tap(disconnectButton); 164 MockInteractions.tap(disconnectButton);
165 Polymer.dom.flush(); 165 Polymer.dom.flush();
166 166
167 assertTrue(peoplePage.$.disconnectDialog.open); 167 assertTrue(peoplePage.$.disconnectDialog.open);
168 assertFalse(peoplePage.$.deleteProfile.hidden); 168 assertFalse(peoplePage.$.deleteProfile.hidden);
169 169
170 var disconnectConfirm = peoplePage.$.disconnectConfirm; 170 var disconnectConfirm = peoplePage.$.disconnectConfirm;
171 assertTrue(!!disconnectConfirm); 171 assertTrue(!!disconnectConfirm);
172 assertFalse(disconnectConfirm.hidden); 172 assertFalse(disconnectConfirm.hidden);
173 173
174 // Wait for exit of dialog route. 174 var popstatePromise = new Promise(function(resolve) {
175 var dialogExitPromise = new Promise(function(resolve) { 175 listenOnce(window, 'popstate', resolve);
176 window.addEventListener('popstate', function callback() {
177 window.removeEventListener('popstate', callback);
178 resolve();
179 });
180 }); 176 });
181 177
182 MockInteractions.tap(disconnectConfirm); 178 MockInteractions.tap(disconnectConfirm);
183 179
184 return dialogExitPromise; 180 return popstatePromise;
185 }).then(function() { 181 }).then(function() {
186 return browserProxy.whenCalled('signOut'); 182 return browserProxy.whenCalled('signOut');
187 }).then(function(deleteProfile) { 183 }).then(function(deleteProfile) {
188 assertFalse(deleteProfile); 184 assertFalse(deleteProfile);
189 185
190 cr.webUIListenerCallback('sync-status-changed', { 186 cr.webUIListenerCallback('sync-status-changed', {
191 signedIn: true, 187 signedIn: true,
192 domain: 'example.com', 188 domain: 'example.com',
193 }); 189 });
194 Polymer.dom.flush(); 190 Polymer.dom.flush();
195 191
196 assertFalse(peoplePage.$.disconnectDialog.open); 192 assertFalse(peoplePage.$.disconnectDialog.open);
197 MockInteractions.tap(disconnectButton); 193 MockInteractions.tap(disconnectButton);
198 Polymer.dom.flush(); 194 Polymer.dom.flush();
199 195
200 assertTrue(peoplePage.$.disconnectDialog.open); 196 assertTrue(peoplePage.$.disconnectDialog.open);
201 assertTrue(peoplePage.$.deleteProfile.hidden); 197 assertTrue(peoplePage.$.deleteProfile.hidden);
202 198
203 var disconnectManagedProfileConfirm = 199 var disconnectManagedProfileConfirm =
204 peoplePage.$.disconnectManagedProfileConfirm; 200 peoplePage.$.disconnectManagedProfileConfirm;
205 assertTrue(!!disconnectManagedProfileConfirm); 201 assertTrue(!!disconnectManagedProfileConfirm);
206 assertFalse(disconnectManagedProfileConfirm.hidden); 202 assertFalse(disconnectManagedProfileConfirm.hidden);
207 203
208 browserProxy.resetResolver('signOut'); 204 browserProxy.resetResolver('signOut');
205
206 var popstatePromise = new Promise(function(resolve) {
207 listenOnce(window, 'popstate', resolve);
208 });
209
209 MockInteractions.tap(disconnectManagedProfileConfirm); 210 MockInteractions.tap(disconnectManagedProfileConfirm);
210 211
212 return popstatePromise;
213 }).then(function() {
211 return browserProxy.whenCalled('signOut'); 214 return browserProxy.whenCalled('signOut');
212 }).then(function(deleteProfile) { 215 }).then(function(deleteProfile) {
213 assertTrue(deleteProfile); 216 assertTrue(deleteProfile);
214 }); 217 });
215 }); 218 });
216 219
220 test('Signout dialog suppressed when not signed in', function() {
221 return browserProxy.whenCalled('getSyncStatus').then(function() {
222 Polymer.dom.flush();
223
224 settings.navigateTo(settings.Route.SIGN_OUT);
225 Polymer.dom.flush();
226
227 assertTrue(peoplePage.$.disconnectDialog.open);
228
229 var popstatePromise = new Promise(function(resolve) {
230 listenOnce(window, 'popstate', resolve);
231 });
232
233 cr.webUIListenerCallback('sync-status-changed', {
234 signedIn: false,
235 });
236
237 return popstatePromise;
238 }).then(function() {
239 var popstatePromise = new Promise(function(resolve) {
240 listenOnce(window, 'popstate', resolve);
241 });
242
243 settings.navigateTo(settings.Route.SIGN_OUT);
244
245 return popstatePromise;
246 });
247 });
248
217 test('ActivityControlsLink', function() { 249 test('ActivityControlsLink', function() {
218 return browserProxy.whenCalled('getSyncStatus').then(function() { 250 return browserProxy.whenCalled('getSyncStatus').then(function() {
219 Polymer.dom.flush(); 251 Polymer.dom.flush();
220 252
221 var activityControls = peoplePage.$$('#activity-controls'); 253 var activityControls = peoplePage.$$('#activity-controls');
222 assertTrue(!!activityControls); 254 assertTrue(!!activityControls);
223 assertFalse(activityControls.hidden); 255 assertFalse(activityControls.hidden);
224 256
225 cr.webUIListenerCallback('sync-status-changed', { 257 cr.webUIListenerCallback('sync-status-changed', {
226 signedIn: false, 258 signedIn: false,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 322 }
291 323
292 return { 324 return {
293 registerTests: function() { 325 registerTests: function() {
294 registerProfileInfoTests(); 326 registerProfileInfoTests();
295 if (!cr.isChromeOS) 327 if (!cr.isChromeOS)
296 registerSyncStatusTests(); 328 registerSyncStatusTests();
297 }, 329 },
298 }; 330 };
299 }); 331 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/people_page/people_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698