| 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 /** @fileoverview Suite of tests for Easy Unlock within People section. */ | 5 /** @fileoverview Suite of tests for Easy Unlock within People section. */ |
| 6 | 6 |
| 7 GEN_INCLUDE(['settings_page_browsertest.js']); | 7 GEN_INCLUDE(['settings_page_browsertest.js']); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * @constructor | 10 * @constructor |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 expectFalse(turnOffButton.hidden) | 186 expectFalse(turnOffButton.hidden) |
| 187 | 187 |
| 188 MockInteractions.tap(turnOffButton); | 188 MockInteractions.tap(turnOffButton); |
| 189 return browserProxy.whenCalled('getTurnOffFlowStatus'); | 189 return browserProxy.whenCalled('getTurnOffFlowStatus'); |
| 190 }).then(function() { | 190 }).then(function() { |
| 191 Polymer.dom.flush(); | 191 Polymer.dom.flush(); |
| 192 | 192 |
| 193 turnOffDialog = page.$$('#easyUnlockTurnOffDialog'); | 193 turnOffDialog = page.$$('#easyUnlockTurnOffDialog'); |
| 194 assertTrue(!!turnOffDialog); | 194 assertTrue(!!turnOffDialog); |
| 195 | 195 |
| 196 // Verify that elements on the turn off dialog are hidden or active |
| 197 // according to the easy unlock turn off status. |
| 198 var turnOffDialogButtonContainer = |
| 199 turnOffDialog.$$('.button-container'); |
| 200 var turnOffDialogButtonSpinner = turnOffDialog.$$('paper-spinner'); |
| 196 var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff'); | 201 var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff'); |
| 202 var turnOffDialogCancelButton = turnOffDialog.$$('.cancel-button'); |
| 203 assertTrue(!!turnOffDialogButtonContainer); |
| 204 assertTrue(!!turnOffDialogButtonSpinner); |
| 197 assertTrue(!!turnOffDialogConfirmButton); | 205 assertTrue(!!turnOffDialogConfirmButton); |
| 206 assertTrue(!!turnOffDialogCancelButton); |
| 207 |
| 208 cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'offline'); |
| 209 expectTrue(turnOffDialogButtonContainer.hidden); |
| 210 expectFalse(turnOffDialogButtonSpinner.active); |
| 211 |
| 212 cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'pending'); |
| 213 expectFalse(turnOffDialogButtonContainer.hidden); |
| 214 expectTrue(turnOffDialogButtonSpinner.active); |
| 215 |
| 216 cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', |
| 217 'server-error'); |
| 218 expectFalse(turnOffDialogButtonContainer.hidden); |
| 219 expectTrue(turnOffDialogCancelButton.hidden); |
| 220 |
| 221 cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'idle'); |
| 198 expectFalse(turnOffDialogConfirmButton.hidden); | 222 expectFalse(turnOffDialogConfirmButton.hidden); |
| 199 | 223 |
| 200 MockInteractions.tap(turnOffDialogConfirmButton); | 224 MockInteractions.tap(turnOffDialogConfirmButton); |
| 201 | 225 |
| 202 return browserProxy.whenCalled('startTurnOffFlow'); | 226 return browserProxy.whenCalled('startTurnOffFlow'); |
| 203 }).then(function() { | 227 }).then(function() { |
| 204 // To signal successful turnoff, the enabled status is broadcast | 228 // To signal successful turnoff, the enabled status is broadcast |
| 205 // as false. At that point, the dialog should close and cancel | 229 // as false. At that point, the dialog should close and cancel |
| 206 // any in-progress turnoff flow. The cancellation should be | 230 // any in-progress turnoff flow. The cancellation should be |
| 207 // a no-op assuming the turnoff originated from this tab. | 231 // a no-op assuming the turnoff originated from this tab. |
| 208 cr.webUIListenerCallback('easy-unlock-enabled-status', false); | 232 cr.webUIListenerCallback('easy-unlock-enabled-status', false); |
| 209 return browserProxy.whenCalled('cancelTurnOffFlow'); | 233 return browserProxy.whenCalled('cancelTurnOffFlow'); |
| 210 }).then(function() { | 234 }).then(function() { |
| 211 Polymer.dom.flush(); | 235 Polymer.dom.flush(); |
| 212 expectFalse(turnOffDialog.$.dialog.open); | 236 expectFalse(turnOffDialog.$.dialog.open); |
| 213 }); | 237 }); |
| 214 }); | 238 }); |
| 215 }); | 239 }); |
| 216 | 240 |
| 217 // Run all registered tests. | 241 // Run all registered tests. |
| 218 mocha.run(); | 242 mocha.run(); |
| 219 }); | 243 }); |
| OLD | NEW |