Chromium Code Reviews| 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('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 var controlBarElement = document.createElement('control-bar'); | 8 var controlBarElement = document.createElement('control-bar'); |
| 9 document.body.appendChild(controlBarElement); | 9 document.body.appendChild(controlBarElement); |
| 10 return controlBarElement; | 10 return controlBarElement; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 MockInteractions.tap(controlBarElement.$.launchGuest); | 104 MockInteractions.tap(controlBarElement.$.launchGuest); |
| 105 | 105 |
| 106 return browserProxy.whenCalled('areAllProfilesLocked').then(function() { | 106 return browserProxy.whenCalled('areAllProfilesLocked').then(function() { |
| 107 // Make sure DOM is up to date. | 107 // Make sure DOM is up to date. |
| 108 Polymer.dom.flush(); | 108 Polymer.dom.flush(); |
| 109 | 109 |
| 110 // The error dialog is visible. | 110 // The error dialog is visible. |
| 111 assertTrue(errorDialogElement.$.dialog.opened); | 111 assertTrue(errorDialogElement.$.dialog.opened); |
| 112 }); | 112 }); |
| 113 }); | 113 }); |
| 114 | |
| 115 test('Can create profile with force signin', function() { | |
| 116 controlBarElement.isForceSigninEnabled_ = true; | |
| 117 Polymer.dom.flush(); | |
| 118 return new Promise(function(resolve, reject) { | |
| 119 // We expect to go to the 'create-profile' page. | |
| 120 controlBarElement.addEventListener('change-page', function(event) { | |
|
tommycli
2016/11/17 23:06:23
You can use the listenOnce method instead, since t
zmin
2016/11/17 23:30:04
Done. Also did to the test case above which is the
| |
| 121 if (event.detail.page == 'create-user-page') | |
| 122 resolve(); | |
| 123 }); | |
| 124 | |
| 125 // Simulate clicking 'Create Profile'. | |
| 126 MockInteractions.tap(controlBarElement.$.addUser); | |
| 127 }); | |
| 128 }); | |
| 129 | |
| 130 test('Can launch guest profile with force sign in', function() { | |
| 131 controlBarElement.isForceSigninEnabled_ = true; | |
| 132 Polymer.dom.flush(); | |
| 133 MockInteractions.tap(controlBarElement.$.launchGuest); | |
| 134 return browserProxy.whenCalled('launchGuestUser'); | |
| 135 }); | |
| 136 | |
| 114 }); | 137 }); |
| 115 } | 138 } |
| 116 | 139 |
| 117 return { | 140 return { |
| 118 registerTests: registerTests, | 141 registerTests: registerTests, |
| 119 }; | 142 }; |
| 120 }); | 143 }); |
| OLD | NEW |