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

Side by Side Diff: chrome/test/data/webui/md_user_manager/control_bar_tests.js

Issue 2036763003: MD User Manager: Fixes flaky tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/md_user_manager/create_profile_tests.js » ('j') | 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('user_manager.control_bar_tests', function() { 5 cr.define('user_manager.control_bar_tests', function() {
6 /** @return {!ControlBarElement} */ 6 /** @return {!ControlBarElement} */
7 function createElement() { 7 function createElement() {
8 PolymerTest.clearBody();
9 var controlBarElement = document.createElement('control-bar'); 8 var controlBarElement = document.createElement('control-bar');
10 document.body.appendChild(controlBarElement); 9 document.body.appendChild(controlBarElement);
11 return controlBarElement; 10 return controlBarElement;
12 } 11 }
13 12
14 function registerTests() { 13 function registerTests() {
15 /** @type {?TestProfileBrowserProxy} */ 14 /** @type {?TestProfileBrowserProxy} */
16 var browserProxy = null; 15 var browserProxy = null;
17 16
18 /** @type {?ControlBarElement} */ 17 /** @type {?ControlBarElement} */
19 var controlBarElement = null; 18 var controlBarElement = null;
20 19
21 suite('ControlBarTests', function() { 20 suite('ControlBarTests', function() {
22 setup(function() { 21 setup(function() {
23 browserProxy = new TestProfileBrowserProxy(); 22 browserProxy = new TestProfileBrowserProxy();
24 // Replace real proxy with mock proxy. 23 // Replace real proxy with mock proxy.
25 signin.ProfileBrowserProxyImpl.instance_ = browserProxy; 24 signin.ProfileBrowserProxyImpl.instance_ = browserProxy;
26 25
27 controlBarElement = createElement(); 26 controlBarElement = createElement();
28 }); 27 });
29 28
30 teardown(function() { controlBarElement.remove(); }); 29 teardown(function(done) {
30 controlBarElement.remove();
31 // Allow asynchronous tasks to finish.
32 setTimeout(done);
33 });
31 34
32 test('Actions are hidden by default', function() { 35 test('Actions are hidden by default', function() {
33 assertTrue(controlBarElement.$.launchGuest.hidden); 36 assertTrue(controlBarElement.$.launchGuest.hidden);
34 assertTrue(controlBarElement.$.addUser.hidden); 37 assertTrue(controlBarElement.$.addUser.hidden);
35 38
36 controlBarElement.showGuest = true; 39 controlBarElement.showGuest = true;
37 controlBarElement.showAddPerson = true; 40 controlBarElement.showAddPerson = true;
38 Polymer.dom.flush(); 41 Polymer.dom.flush();
39 42
40 assertFalse(controlBarElement.$.launchGuest.hidden); 43 assertFalse(controlBarElement.$.launchGuest.hidden);
(...skipping 26 matching lines...) Expand all
67 70
68 setup(function() { 71 setup(function() {
69 browserProxy = new TestProfileBrowserProxy(); 72 browserProxy = new TestProfileBrowserProxy();
70 // Replace real proxy with mock proxy. 73 // Replace real proxy with mock proxy.
71 signin.ProfileBrowserProxyImpl.instance_ = browserProxy; 74 signin.ProfileBrowserProxyImpl.instance_ = browserProxy;
72 75
73 browserProxy.setAllProfilesLocked(true); 76 browserProxy.setAllProfilesLocked(true);
74 77
75 controlBarElement = createElement(); 78 controlBarElement = createElement();
76 79
77 errorDialogElement = document.createElement('error-dialog'); 80 errorDialogElement = document.querySelector('error-dialog');
78 document.body.appendChild(errorDialogElement);
79 }); 81 });
80 82
81 teardown(function() { 83 teardown(function(done) {
82 controlBarElement.remove(); 84 controlBarElement.remove();
83 errorDialogElement.remove(); 85 // Allow asynchronous tasks to finish.
86 setTimeout(done);
84 }); 87 });
85 88
86 test('Cannot create profile', function() { 89 test('Cannot create profile', function() {
87 // Simulate clicking 'Create Profile'. 90 // Simulate clicking 'Create Profile'.
88 MockInteractions.tap(controlBarElement.$.addUser); 91 MockInteractions.tap(controlBarElement.$.addUser);
89 92
90 return browserProxy.whenCalled('areAllProfilesLocked').then(function() { 93 return browserProxy.whenCalled('areAllProfilesLocked').then(function() {
91 // Make sure DOM is up to date. 94 // Make sure DOM is up to date.
92 Polymer.dom.flush(); 95 Polymer.dom.flush();
93 96
(...skipping 14 matching lines...) Expand all
108 assertLT(0, errorDialogElement.$$('#backdrop').offsetHeight); 111 assertLT(0, errorDialogElement.$$('#backdrop').offsetHeight);
109 }); 112 });
110 }); 113 });
111 }); 114 });
112 } 115 }
113 116
114 return { 117 return {
115 registerTests: registerTests, 118 registerTests: registerTests,
116 }; 119 };
117 }); 120 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/md_user_manager/create_profile_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698