| Index: chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
|
| diff --git a/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js b/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
|
| index 2659015423078d5623788d730c0f07a342f0c0bc..b9b1a1aea5d9229cc82f3a5d8f5504e08c0c580b 100644
|
| --- a/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
|
| +++ b/chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js
|
| @@ -37,7 +37,7 @@ GEN('#else');
|
| GEN('#define MAYBE_EasyUnlock EasyUnlock');
|
| GEN('#endif');
|
|
|
| -// Runs change picture tests.
|
| +// Runs easy unlock tests.
|
| TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
|
| /**
|
| * A test version of EasyUnlockBrowserProxy. Provides helper methods
|
| @@ -99,20 +99,14 @@ TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
|
| },
|
| };
|
|
|
| - /** @type {?SettingsPeoplePageElement} */
|
| - var page = null;
|
| + /** @type {?SettingsLockScreenElement} */
|
| + var lockScreen = null;
|
|
|
| /** @type {?TestEasyUnlockBrowserProxy} */
|
| var browserProxy = null;
|
|
|
| - /** @type {?CrSettingsPrefs} */
|
| - var prefs = null;
|
| -
|
| - var self = this;
|
| -
|
| suite('SettingsEasyUnlock', function() {
|
| suiteSetup(function() {
|
| - self.basicPage.set('pageVisibility.people', true);
|
| Polymer.dom.flush();
|
|
|
| // These overrides are necessary for this test to function on ChromeOS
|
| @@ -131,10 +125,6 @@ TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
|
| easyUnlockTurnOffDescription: '',
|
| easyUnlockTurnOffButton: '',
|
| });
|
| -
|
| - // Before clearing the body, save a copy of the real prefs so we can
|
| - // cleanly re-create the People page element.
|
| - prefs = document.querySelector('settings-ui').$$('settings-prefs').prefs;
|
| });
|
|
|
| setup(function() {
|
| @@ -142,25 +132,19 @@ TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
|
| settings.EasyUnlockBrowserProxyImpl.instance_ = browserProxy;
|
|
|
| PolymerTest.clearBody();
|
| - page = document.createElement('settings-people-page');
|
| - page.currentRoute = {
|
| - page: 'basic',
|
| - section: '',
|
| - subpage: [],
|
| - };
|
| - page.prefs = prefs;
|
| + lockScreen = document.createElement('settings-lock-screen');
|
| });
|
|
|
| test('setup button', function() {
|
| - document.body.appendChild(page);
|
| + document.body.appendChild(lockScreen);
|
|
|
| return browserProxy.whenCalled('getEnabledStatus').then(function() {
|
| - assertTrue(page.easyUnlockAllowed_);
|
| - expectFalse(page.easyUnlockEnabled_);
|
| + assertTrue(lockScreen.easyUnlockAllowed_);
|
| + expectFalse(lockScreen.easyUnlockEnabled_);
|
|
|
| Polymer.dom.flush();
|
|
|
| - var setupButton = page.$$('#easyUnlockSetup');
|
| + var setupButton = lockScreen.$$('#easyUnlockSetup');
|
| assertTrue(!!setupButton);
|
| expectFalse(setupButton.hidden);
|
|
|
| @@ -171,70 +155,77 @@ TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
|
|
|
| test('turn off dialog', function() {
|
| browserProxy.setEnabledStatus(true);
|
| - document.body.appendChild(page);
|
| + document.body.appendChild(lockScreen);
|
|
|
| var turnOffDialog = null;
|
|
|
| - return browserProxy.whenCalled('getEnabledStatus').then(function() {
|
| - assertTrue(page.easyUnlockAllowed_);
|
| - expectTrue(page.easyUnlockEnabled_);
|
| -
|
| - Polymer.dom.flush();
|
| -
|
| - var turnOffButton = page.$$('#easyUnlockTurnOff');
|
| - assertTrue(!!turnOffButton);
|
| - expectFalse(turnOffButton.hidden)
|
| -
|
| - MockInteractions.tap(turnOffButton);
|
| - return browserProxy.whenCalled('getTurnOffFlowStatus');
|
| - }).then(function() {
|
| - Polymer.dom.flush();
|
| -
|
| - turnOffDialog = page.$$('#easyUnlockTurnOffDialog');
|
| - assertTrue(!!turnOffDialog);
|
| -
|
| - // Verify that elements on the turn off dialog are hidden or active
|
| - // according to the easy unlock turn off status.
|
| - var turnOffDialogButtonContainer =
|
| - turnOffDialog.$$('.button-container');
|
| - var turnOffDialogButtonSpinner = turnOffDialog.$$('paper-spinner');
|
| - var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff');
|
| - var turnOffDialogCancelButton = turnOffDialog.$$('.cancel-button');
|
| - assertTrue(!!turnOffDialogButtonContainer);
|
| - assertTrue(!!turnOffDialogButtonSpinner);
|
| - assertTrue(!!turnOffDialogConfirmButton);
|
| - assertTrue(!!turnOffDialogCancelButton);
|
| -
|
| - cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'offline');
|
| - expectTrue(turnOffDialogButtonContainer.hidden);
|
| - expectFalse(turnOffDialogButtonSpinner.active);
|
| -
|
| - cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'pending');
|
| - expectFalse(turnOffDialogButtonContainer.hidden);
|
| - expectTrue(turnOffDialogButtonSpinner.active);
|
| -
|
| - cr.webUIListenerCallback('easy-unlock-turn-off-flow-status',
|
| - 'server-error');
|
| - expectFalse(turnOffDialogButtonContainer.hidden);
|
| - expectTrue(turnOffDialogCancelButton.hidden);
|
| -
|
| - cr.webUIListenerCallback('easy-unlock-turn-off-flow-status', 'idle');
|
| - expectFalse(turnOffDialogConfirmButton.hidden);
|
| -
|
| - MockInteractions.tap(turnOffDialogConfirmButton);
|
| -
|
| - return browserProxy.whenCalled('startTurnOffFlow');
|
| - }).then(function() {
|
| - // To signal successful turnoff, the enabled status is broadcast
|
| - // as false. At that point, the dialog should close and cancel
|
| - // any in-progress turnoff flow. The cancellation should be
|
| - // a no-op assuming the turnoff originated from this tab.
|
| - cr.webUIListenerCallback('easy-unlock-enabled-status', false);
|
| - return browserProxy.whenCalled('cancelTurnOffFlow');
|
| - }).then(function() {
|
| - Polymer.dom.flush();
|
| - expectFalse(turnOffDialog.$.dialog.open);
|
| - });
|
| + return browserProxy.whenCalled('getEnabledStatus')
|
| + .then(function() {
|
| + assertTrue(lockScreen.easyUnlockAllowed_);
|
| + expectTrue(lockScreen.easyUnlockEnabled_);
|
| +
|
| + Polymer.dom.flush();
|
| +
|
| + var turnOffButton = lockScreen.$$('#easyUnlockTurnOff');
|
| + assertTrue(!!turnOffButton);
|
| + expectFalse(turnOffButton.hidden)
|
| +
|
| + MockInteractions.tap(turnOffButton);
|
| + return browserProxy.whenCalled('getTurnOffFlowStatus');
|
| + })
|
| + .then(function() {
|
| + Polymer.dom.flush();
|
| +
|
| + turnOffDialog = lockScreen.$$('#easyUnlockTurnOffDialog');
|
| + assertTrue(!!turnOffDialog);
|
| +
|
| + // Verify that elements on the turn off dialog are hidden or active
|
| + // according to the easy unlock turn off status.
|
| + var turnOffDialogButtonContainer =
|
| + turnOffDialog.$$('.button-container');
|
| + var turnOffDialogButtonSpinner = turnOffDialog.$$('paper-spinner');
|
| + var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff');
|
| + var turnOffDialogCancelButton = turnOffDialog.$$('.cancel-button');
|
| + assertTrue(!!turnOffDialogButtonContainer);
|
| + assertTrue(!!turnOffDialogButtonSpinner);
|
| + assertTrue(!!turnOffDialogConfirmButton);
|
| + assertTrue(!!turnOffDialogCancelButton);
|
| +
|
| + cr.webUIListenerCallback(
|
| + 'easy-unlock-turn-off-flow-status', 'offline');
|
| + expectTrue(turnOffDialogButtonContainer.hidden);
|
| + expectFalse(turnOffDialogButtonSpinner.active);
|
| +
|
| + cr.webUIListenerCallback(
|
| + 'easy-unlock-turn-off-flow-status', 'pending');
|
| + expectFalse(turnOffDialogButtonContainer.hidden);
|
| + expectTrue(turnOffDialogButtonSpinner.active);
|
| +
|
| + cr.webUIListenerCallback(
|
| + 'easy-unlock-turn-off-flow-status', 'server-error');
|
| + expectFalse(turnOffDialogButtonContainer.hidden);
|
| + expectTrue(turnOffDialogCancelButton.hidden);
|
| +
|
| + cr.webUIListenerCallback(
|
| + 'easy-unlock-turn-off-flow-status', 'idle');
|
| + expectFalse(turnOffDialogConfirmButton.hidden);
|
| +
|
| + MockInteractions.tap(turnOffDialogConfirmButton);
|
| +
|
| + return browserProxy.whenCalled('startTurnOffFlow');
|
| + })
|
| + .then(function() {
|
| + // To signal successful turnoff, the enabled status is broadcast
|
| + // as false. At that point, the dialog should close and cancel
|
| + // any in-progress turnoff flow. The cancellation should be
|
| + // a no-op assuming the turnoff originated from this tab.
|
| + cr.webUIListenerCallback('easy-unlock-enabled-status', false);
|
| + return browserProxy.whenCalled('cancelTurnOffFlow');
|
| + })
|
| + .then(function() {
|
| + Polymer.dom.flush();
|
| + expectFalse(turnOffDialog.$.dialog.open);
|
| + });
|
| });
|
| });
|
|
|
|
|