Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: chrome/test/data/webui/settings/easy_unlock_browsertest_chromeos.js

Issue 2787153002: MD Settings: Move easy unlock from people to lock screen. (Closed)
Patch Set: Browser tests. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 30
31 // Times out on debug builders and may time out on memory bots because 31 // Times out on debug builders and may time out on memory bots because
32 // the Settings page can take several seconds to load in a Release build 32 // the Settings page can take several seconds to load in a Release build
33 // and several times that in a Debug build. See https://crbug.com/558434. 33 // and several times that in a Debug build. See https://crbug.com/558434.
34 GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)'); 34 GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)');
35 GEN('#define MAYBE_EasyUnlock DISABLED_EasyUnlock'); 35 GEN('#define MAYBE_EasyUnlock DISABLED_EasyUnlock');
36 GEN('#else'); 36 GEN('#else');
37 GEN('#define MAYBE_EasyUnlock EasyUnlock'); 37 GEN('#define MAYBE_EasyUnlock EasyUnlock');
38 GEN('#endif'); 38 GEN('#endif');
39 39
40 // Runs change picture tests. 40 // Runs easy unlock tests.
41 TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() { 41 TEST_F('SettingsEasyUnlockBrowserTest', 'MAYBE_EasyUnlock', function() {
42 /** 42 /**
43 * A test version of EasyUnlockBrowserProxy. Provides helper methods 43 * A test version of EasyUnlockBrowserProxy. Provides helper methods
44 * for allowing tests to know when a method was called, as well as 44 * for allowing tests to know when a method was called, as well as
45 * specifying mock responses. 45 * specifying mock responses.
46 * 46 *
47 * @constructor 47 * @constructor
48 * @implements {settings.EasyUnlockBrowserProxy} 48 * @implements {settings.EasyUnlockBrowserProxy}
49 * @extends {settings.TestBrowserProxy} 49 * @extends {settings.TestBrowserProxy}
50 */ 50 */
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 startTurnOffFlow: function() { 92 startTurnOffFlow: function() {
93 this.methodCalled('startTurnOffFlow'); 93 this.methodCalled('startTurnOffFlow');
94 }, 94 },
95 95
96 /** @override */ 96 /** @override */
97 cancelTurnOffFlow: function() { 97 cancelTurnOffFlow: function() {
98 this.methodCalled('cancelTurnOffFlow'); 98 this.methodCalled('cancelTurnOffFlow');
99 }, 99 },
100 }; 100 };
101 101
102 /** @type {?SettingsPeoplePageElement} */ 102 /** @type {?SettingsLockScreenElement} */
103 var page = null; 103 var lockScreen = null;
104 104
105 /** @type {?TestEasyUnlockBrowserProxy} */ 105 /** @type {?TestEasyUnlockBrowserProxy} */
106 var browserProxy = null; 106 var browserProxy = null;
107 107
108 /** @type {?CrSettingsPrefs} */
109 var prefs = null;
110
111 var self = this;
112
113 suite('SettingsEasyUnlock', function() { 108 suite('SettingsEasyUnlock', function() {
114 suiteSetup(function() { 109 suiteSetup(function() {
115 self.basicPage.set('pageVisibility.people', true);
116 Polymer.dom.flush(); 110 Polymer.dom.flush();
117 111
118 // These overrides are necessary for this test to function on ChromeOS 112 // These overrides are necessary for this test to function on ChromeOS
119 // bots that do not have Bluetooth (don't actually support Easy Unlock). 113 // bots that do not have Bluetooth (don't actually support Easy Unlock).
120 loadTimeData.overrideValues({ 114 loadTimeData.overrideValues({
121 easyUnlockAllowed: true, 115 easyUnlockAllowed: true,
122 easyUnlockProximityDetectionAllowed: false, 116 easyUnlockProximityDetectionAllowed: false,
123 117
124 easyUnlockSectionTitle: '', 118 easyUnlockSectionTitle: '',
125 easyUnlockLearnMoreURL: '', 119 easyUnlockLearnMoreURL: '',
126 easyUnlockSetupIntro: '', 120 easyUnlockSetupIntro: '',
127 easyUnlockSetupButton: '', 121 easyUnlockSetupButton: '',
128 122
129 easyUnlockDescription: '', 123 easyUnlockDescription: '',
130 easyUnlockTurnOffTitle: '', 124 easyUnlockTurnOffTitle: '',
131 easyUnlockTurnOffDescription: '', 125 easyUnlockTurnOffDescription: '',
132 easyUnlockTurnOffButton: '', 126 easyUnlockTurnOffButton: '',
133 }); 127 });
134
135 // Before clearing the body, save a copy of the real prefs so we can
136 // cleanly re-create the People page element.
137 prefs = document.querySelector('settings-ui').$$('settings-prefs').prefs;
138 }); 128 });
139 129
140 setup(function() { 130 setup(function() {
141 browserProxy = new TestEasyUnlockBrowserProxy(); 131 browserProxy = new TestEasyUnlockBrowserProxy();
142 settings.EasyUnlockBrowserProxyImpl.instance_ = browserProxy; 132 settings.EasyUnlockBrowserProxyImpl.instance_ = browserProxy;
143 133
144 PolymerTest.clearBody(); 134 PolymerTest.clearBody();
145 page = document.createElement('settings-people-page'); 135 lockScreen = document.createElement('settings-lock-screen');
146 page.currentRoute = {
147 page: 'basic',
148 section: '',
149 subpage: [],
150 };
151 page.prefs = prefs;
152 }); 136 });
153 137
154 test('setup button', function() { 138 test('setup button', function() {
155 document.body.appendChild(page); 139 document.body.appendChild(lockScreen);
156 140
157 return browserProxy.whenCalled('getEnabledStatus').then(function() { 141 return browserProxy.whenCalled('getEnabledStatus').then(function() {
158 assertTrue(page.easyUnlockAllowed_); 142 assertTrue(lockScreen.easyUnlockAllowed_);
159 expectFalse(page.easyUnlockEnabled_); 143 expectFalse(lockScreen.easyUnlockEnabled_);
160 144
161 Polymer.dom.flush(); 145 Polymer.dom.flush();
162 146
163 var setupButton = page.$$('#easyUnlockSetup'); 147 var setupButton = lockScreen.$$('#easyUnlockSetup');
164 assertTrue(!!setupButton); 148 assertTrue(!!setupButton);
165 expectFalse(setupButton.hidden); 149 expectFalse(setupButton.hidden);
166 150
167 MockInteractions.tap(setupButton); 151 MockInteractions.tap(setupButton);
168 return browserProxy.whenCalled('startTurnOnFlow'); 152 return browserProxy.whenCalled('startTurnOnFlow');
169 }); 153 });
170 }); 154 });
171 155
172 test('turn off dialog', function() { 156 test('turn off dialog', function() {
173 browserProxy.setEnabledStatus(true); 157 browserProxy.setEnabledStatus(true);
174 document.body.appendChild(page); 158 document.body.appendChild(lockScreen);
175 159
176 var turnOffDialog = null; 160 var turnOffDialog = null;
177 161
178 return browserProxy.whenCalled('getEnabledStatus').then(function() { 162 return browserProxy.whenCalled('getEnabledStatus').then(function() {
179 assertTrue(page.easyUnlockAllowed_); 163 assertTrue(lockScreen.easyUnlockAllowed_);
180 expectTrue(page.easyUnlockEnabled_); 164 expectTrue(lockScreen.easyUnlockEnabled_);
181 165
182 Polymer.dom.flush(); 166 Polymer.dom.flush();
183 167
184 var turnOffButton = page.$$('#easyUnlockTurnOff'); 168 var turnOffButton = lockScreen.$$('#easyUnlockTurnOff');
185 assertTrue(!!turnOffButton); 169 assertTrue(!!turnOffButton);
186 expectFalse(turnOffButton.hidden) 170 expectFalse(turnOffButton.hidden)
187 171
188 MockInteractions.tap(turnOffButton); 172 MockInteractions.tap(turnOffButton);
189 return browserProxy.whenCalled('getTurnOffFlowStatus'); 173 return browserProxy.whenCalled('getTurnOffFlowStatus');
190 }).then(function() { 174 }).then(function() {
191 Polymer.dom.flush(); 175 Polymer.dom.flush();
192 176
193 turnOffDialog = page.$$('#easyUnlockTurnOffDialog'); 177 turnOffDialog = lockScreen.$$('#easyUnlockTurnOffDialog');
194 assertTrue(!!turnOffDialog); 178 assertTrue(!!turnOffDialog);
195 179
196 // Verify that elements on the turn off dialog are hidden or active 180 // Verify that elements on the turn off dialog are hidden or active
197 // according to the easy unlock turn off status. 181 // according to the easy unlock turn off status.
198 var turnOffDialogButtonContainer = 182 var turnOffDialogButtonContainer =
199 turnOffDialog.$$('.button-container'); 183 turnOffDialog.$$('.button-container');
200 var turnOffDialogButtonSpinner = turnOffDialog.$$('paper-spinner'); 184 var turnOffDialogButtonSpinner = turnOffDialog.$$('paper-spinner');
201 var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff'); 185 var turnOffDialogConfirmButton = turnOffDialog.$$('#turnOff');
202 var turnOffDialogCancelButton = turnOffDialog.$$('.cancel-button'); 186 var turnOffDialogCancelButton = turnOffDialog.$$('.cancel-button');
203 assertTrue(!!turnOffDialogButtonContainer); 187 assertTrue(!!turnOffDialogButtonContainer);
(...skipping 30 matching lines...) Expand all
234 }).then(function() { 218 }).then(function() {
235 Polymer.dom.flush(); 219 Polymer.dom.flush();
236 expectFalse(turnOffDialog.$.dialog.open); 220 expectFalse(turnOffDialog.$.dialog.open);
237 }); 221 });
238 }); 222 });
239 }); 223 });
240 224
241 // Run all registered tests. 225 // Run all registered tests.
242 mocha.run(); 226 mocha.run();
243 }); 227 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698