| 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 29 matching lines...) Expand all Loading... |
| 40 controlBarElement.showAddPerson = true; | 40 controlBarElement.showAddPerson = true; |
| 41 Polymer.dom.flush(); | 41 Polymer.dom.flush(); |
| 42 | 42 |
| 43 assertFalse(controlBarElement.$.launchGuest.hidden); | 43 assertFalse(controlBarElement.$.launchGuest.hidden); |
| 44 assertFalse(controlBarElement.$.addUser.hidden); | 44 assertFalse(controlBarElement.$.addUser.hidden); |
| 45 }); | 45 }); |
| 46 | 46 |
| 47 test('Can create profile', function() { | 47 test('Can create profile', function() { |
| 48 return new Promise(function(resolve, reject) { | 48 return new Promise(function(resolve, reject) { |
| 49 // We expect to go to the 'create-profile' page. | 49 // We expect to go to the 'create-profile' page. |
| 50 controlBarElement.addEventListener('change-page', function(event) { | 50 listenOnce(controlBarElement, 'change-page', function(event) { |
| 51 if (event.detail.page == 'create-user-page') | 51 if (event.detail.page == 'create-user-page') |
| 52 resolve(); | 52 resolve(); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 // Simulate clicking 'Create Profile'. | 55 // Simulate clicking 'Create Profile'. |
| 56 MockInteractions.tap(controlBarElement.$.addUser); | 56 MockInteractions.tap(controlBarElement.$.addUser); |
| 57 }); | 57 }); |
| 58 }); | 58 }); |
| 59 | 59 |
| 60 test('Can launch guest profile', function() { | 60 test('Can launch guest profile', function() { |
| (...skipping 43 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 listenOnce(controlBarElement, 'change-page', function(event) { |
| 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 |