| 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('settings_people_page_quick_unlock', function() { | 5 cr.define('settings_people_page_quick_unlock', function() { |
| 6 var element = null; | 6 var element = null; |
| 7 var quickUnlockPrivateApi = null; | 7 var quickUnlockPrivateApi = null; |
| 8 var QuickUnlockMode = chrome.quickUnlockPrivate.QuickUnlockMode; | 8 var QuickUnlockMode = chrome.quickUnlockPrivate.QuickUnlockMode; |
| 9 var fakeUma = null; | 9 var fakeUma = null; |
| 10 | 10 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 assertEquals(0, fakeUma.getHistogramValue( | 298 assertEquals(0, fakeUma.getHistogramValue( |
| 299 LockScreenProgress.CHOOSE_PIN_OR_PASSWORD)); | 299 LockScreenProgress.CHOOSE_PIN_OR_PASSWORD)); |
| 300 assertRadioButtonActive(passwordRadioButton); | 300 assertRadioButtonActive(passwordRadioButton); |
| 301 | 301 |
| 302 MockInteractions.tap(pinPasswordRadioButton); | 302 MockInteractions.tap(pinPasswordRadioButton); |
| 303 assertTrue(isSetupPinButtonVisible()); | 303 assertTrue(isSetupPinButtonVisible()); |
| 304 assertRadioButtonActive(pinPasswordRadioButton) | 304 assertRadioButtonActive(pinPasswordRadioButton) |
| 305 | 305 |
| 306 Polymer.dom.flush(); | 306 Polymer.dom.flush(); |
| 307 MockInteractions.tap(getFromElement('#setupPinButton')); | 307 MockInteractions.tap(getFromElement('#setupPinButton')); |
| 308 Polymer.dom.flush(); |
| 308 var setupPinDialog = getFromElement('#setupPin'); | 309 var setupPinDialog = getFromElement('#setupPin'); |
| 309 assertTrue(setupPinDialog.$.dialog.open); | 310 assertTrue(setupPinDialog.$$('#dialog').open); |
| 310 assertEquals(1, fakeUma.getHistogramValue( | 311 assertEquals(1, fakeUma.getHistogramValue( |
| 311 LockScreenProgress.CHOOSE_PIN_OR_PASSWORD)); | 312 LockScreenProgress.CHOOSE_PIN_OR_PASSWORD)); |
| 312 }); | 313 }); |
| 313 }); | 314 }); |
| 314 } | 315 } |
| 315 | 316 |
| 316 function registerSetupPinDialogTests() { | 317 function registerSetupPinDialogTests() { |
| 317 suite('setup-pin-dialog', function() { | 318 suite('setup-pin-dialog', function() { |
| 318 var titleDiv = null; | 319 var titleDiv = null; |
| 319 var problemDiv = null; | 320 var problemDiv = null; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 330 // Create setup-pin element. | 331 // Create setup-pin element. |
| 331 element = document.createElement('settings-setup-pin-dialog'); | 332 element = document.createElement('settings-setup-pin-dialog'); |
| 332 element.quickUnlockPrivate_ = quickUnlockPrivateApi; | 333 element.quickUnlockPrivate_ = quickUnlockPrivateApi; |
| 333 element.setModes = | 334 element.setModes = |
| 334 quickUnlockPrivateApi.setModes.bind(quickUnlockPrivateApi, ''); | 335 quickUnlockPrivateApi.setModes.bind(quickUnlockPrivateApi, ''); |
| 335 element.writeUma_ = fakeUma.recordProgress.bind(fakeUma); | 336 element.writeUma_ = fakeUma.recordProgress.bind(fakeUma); |
| 336 | 337 |
| 337 document.body.appendChild(element); | 338 document.body.appendChild(element); |
| 338 Polymer.dom.flush(); | 339 Polymer.dom.flush(); |
| 339 | 340 |
| 340 element.open(); | |
| 341 | |
| 342 titleDiv = getFromElement('div[class="title"]'); | 341 titleDiv = getFromElement('div[class="title"]'); |
| 343 problemDiv = getFromElement('#problemDiv'); | 342 problemDiv = getFromElement('#problemDiv'); |
| 344 pinKeyboard = getFromElement('pin-keyboard'); | 343 pinKeyboard = getFromElement('pin-keyboard'); |
| 345 backButton = getFromElement('paper-button[class="cancel-button"]'); | 344 backButton = getFromElement('paper-button[class="cancel-button"]'); |
| 346 continueButton = getFromElement('paper-button[class="action-button"]'); | 345 continueButton = getFromElement('paper-button[class="action-button"]'); |
| 347 | 346 |
| 348 assertTrue(isVisible(backButton)); | 347 assertTrue(isVisible(backButton)); |
| 349 assertTrue(isVisible(continueButton)); | 348 assertTrue(isVisible(continueButton)); |
| 350 }); | 349 }); |
| 351 | 350 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 assertHasClass(problemDiv, 'error'); | 440 assertHasClass(problemDiv, 'error'); |
| 442 | 441 |
| 443 // Changing the PIN changes the error to a warning. | 442 // Changing the PIN changes the error to a warning. |
| 444 pinKeyboard.value = '111'; | 443 pinKeyboard.value = '111'; |
| 445 assertHasClass(problemDiv, 'warning'); | 444 assertHasClass(problemDiv, 'warning'); |
| 446 }); | 445 }); |
| 447 | 446 |
| 448 // Hitting cancel at the setup step dismisses the dialog. | 447 // Hitting cancel at the setup step dismisses the dialog. |
| 449 test('HittingBackButtonResetsState', function() { | 448 test('HittingBackButtonResetsState', function() { |
| 450 MockInteractions.tap(backButton); | 449 MockInteractions.tap(backButton); |
| 451 assertFalse(element.$.dialog.open); | 450 assertFalse(element.$$('#dialog').open); |
| 452 }); | 451 }); |
| 453 | 452 |
| 454 // Hitting cancel at the confirm step dismisses the dialog. | 453 // Hitting cancel at the confirm step dismisses the dialog. |
| 455 test('HittingBackButtonResetsState', function() { | 454 test('HittingBackButtonResetsState', function() { |
| 456 pinKeyboard.value = '1111'; | 455 pinKeyboard.value = '1111'; |
| 457 MockInteractions.tap(continueButton); | 456 MockInteractions.tap(continueButton); |
| 458 MockInteractions.tap(backButton); | 457 MockInteractions.tap(backButton); |
| 459 assertFalse(element.$.dialog.open); | 458 assertFalse(element.$$('#dialog').open); |
| 460 }); | 459 }); |
| 461 | 460 |
| 462 // User has to re-enter PIN for confirm step. | 461 // User has to re-enter PIN for confirm step. |
| 463 test('PinKeyboardIsResetForConfirmStep', function() { | 462 test('PinKeyboardIsResetForConfirmStep', function() { |
| 464 pinKeyboard.value = '1111'; | 463 pinKeyboard.value = '1111'; |
| 465 MockInteractions.tap(continueButton); | 464 MockInteractions.tap(continueButton); |
| 466 assertEquals('', pinKeyboard.value); | 465 assertEquals('', pinKeyboard.value); |
| 467 }); | 466 }); |
| 468 | 467 |
| 469 // Completing the flow results in a call to the quick unlock private API. | 468 // Completing the flow results in a call to the quick unlock private API. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 490 }); | 489 }); |
| 491 }); | 490 }); |
| 492 } | 491 } |
| 493 | 492 |
| 494 return { | 493 return { |
| 495 registerAuthenticateTests: registerAuthenticateTests, | 494 registerAuthenticateTests: registerAuthenticateTests, |
| 496 registerLockScreenTests: registerLockScreenTests, | 495 registerLockScreenTests: registerLockScreenTests, |
| 497 registerSetupPinDialogTests: registerSetupPinDialogTests | 496 registerSetupPinDialogTests: registerSetupPinDialogTests |
| 498 }; | 497 }; |
| 499 }); | 498 }); |
| OLD | NEW |