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

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

Issue 2821133005: md-settings: Fix fingerprint list tests. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {settings.FingerprintBrowserProxy} 7 * @implements {settings.FingerprintBrowserProxy}
8 * @extends {settings.TestBrowserProxy} 8 * @extends {settings.TestBrowserProxy}
9 */ 9 */
10 var TestFingerprintBrowserProxy = function() { 10 var TestFingerprintBrowserProxy = function() {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 settings.FingerprintBrowserProxyImpl.instance_ = browserProxy; 119 settings.FingerprintBrowserProxyImpl.instance_ = browserProxy;
120 120
121 PolymerTest.clearBody(); 121 PolymerTest.clearBody();
122 fingerprintList = document.createElement('settings-fingerprint-list'); 122 fingerprintList = document.createElement('settings-fingerprint-list');
123 document.body.appendChild(fingerprintList); 123 document.body.appendChild(fingerprintList);
124 dialog = fingerprintList.$.setupFingerprint; 124 dialog = fingerprintList.$.setupFingerprint;
125 addAnotherButton = dialog.$.addAnotherButton; 125 addAnotherButton = dialog.$.addAnotherButton;
126 Polymer.dom.flush(); 126 Polymer.dom.flush();
127 return browserProxy.whenCalled('getFingerprintsList').then(function() { 127 return browserProxy.whenCalled('getFingerprintsList').then(function() {
128 assertEquals(0, fingerprintList.fingerprints_.length); 128 assertEquals(0, fingerprintList.fingerprints_.length);
129 browserProxy.resetResolver('getFingerprintsList');
129 }); 130 });
130 }); 131 });
131 132
132 // Verify running through the enroll session workflow 133 // Verify running through the enroll session workflow
133 // (settings-setup-fingerprint-dialog) works as expected. 134 // (settings-setup-fingerprint-dialog) works as expected.
134 test('EnrollingFingerprint', function() { 135 test('EnrollingFingerprint', function() {
135 assertFalse(dialog.$.dialog.open); 136 assertFalse(dialog.$.dialog.open);
136 MockInteractions.tap(fingerprintList.$$('.action-button')); 137 MockInteractions.tap(fingerprintList.$$('.action-button'));
137 return browserProxy.whenCalled('startEnroll').then(function() { 138 return browserProxy.whenCalled('startEnroll').then(function() {
138 assertTrue(dialog.$.dialog.open); 139 assertTrue(dialog.$.dialog.open);
(...skipping 25 matching lines...) Expand all
164 }); 165 });
165 }); 166 });
166 }); 167 });
167 168
168 // Verify enrolling a fingerprint, then enrolling another without closing the 169 // Verify enrolling a fingerprint, then enrolling another without closing the
169 // dialog works as intended. 170 // dialog works as intended.
170 test('EnrollingAnotherFingerprint', function() { 171 test('EnrollingAnotherFingerprint', function() {
171 assertFalse(dialog.$.dialog.open); 172 assertFalse(dialog.$.dialog.open);
172 MockInteractions.tap(fingerprintList.$$('.action-button')); 173 MockInteractions.tap(fingerprintList.$$('.action-button'));
173 return browserProxy.whenCalled('startEnroll').then(function() { 174 return browserProxy.whenCalled('startEnroll').then(function() {
175 browserProxy.resetResolver('startEnroll');
176
174 assertTrue(dialog.$.dialog.open); 177 assertTrue(dialog.$.dialog.open);
175 assertEquals(0, dialog.receivedScanCount_); 178 assertEquals(0, dialog.receivedScanCount_);
176 assertFalse(isVisible(addAnotherButton)); 179 assertFalse(isVisible(addAnotherButton));
177 browserProxy.scanReceived(settings.FingerprintResultType.SUCCESS, true); 180 browserProxy.scanReceived(settings.FingerprintResultType.SUCCESS, true);
178 assertEquals(settings.FingerprintSetupStep.READY, dialog.step_); 181 assertEquals(settings.FingerprintSetupStep.READY, dialog.step_);
179 182
180 // Once the first fingerprint is enrolled, verify that enrolling the
181 // second fingerprint without closing the dialog works as expected.
182 return browserProxy.whenCalled('getFingerprintsList');
183 }).then(function() {
184 assertEquals(1, fingerprintList.fingerprints_.length);
185 assertTrue(dialog.$.dialog.open); 183 assertTrue(dialog.$.dialog.open);
186 assertTrue(isVisible(addAnotherButton)); 184 assertTrue(isVisible(addAnotherButton));
187 MockInteractions.tap(addAnotherButton); 185 MockInteractions.tap(addAnotherButton);
188 return browserProxy.whenCalled('startEnroll'); 186
187 // Once the first fingerprint is enrolled, verify that enrolling the
188 // second fingerprint without closing the dialog works as expected.
189 return Promise.all([
190 browserProxy.whenCalled('startEnroll'),
191 browserProxy.whenCalled('getFingerprintsList')]);
189 }).then(function() { 192 }).then(function() {
193 browserProxy.resetResolver('getFingerprintsList');
194
190 assertTrue(dialog.$.dialog.open); 195 assertTrue(dialog.$.dialog.open);
191 assertFalse(isVisible(addAnotherButton)); 196 assertFalse(isVisible(addAnotherButton));
192 browserProxy.scanReceived(settings.FingerprintResultType.SUCCESS, true); 197 browserProxy.scanReceived(settings.FingerprintResultType.SUCCESS, true);
198
199 // Verify that by tapping the continue button we should exit the dialog
200 // and the fingerprint list should have two fingerprints registered.
201 MockInteractions.tap(dialog.$.closeButton);
193 return browserProxy.whenCalled('getFingerprintsList'); 202 return browserProxy.whenCalled('getFingerprintsList');
194 }).then(function() { 203 }).then(function() {
195 assertEquals(2, fingerprintList.fingerprints_.length); 204 assertEquals(2, fingerprintList.fingerprints_.length);
196 }); 205 });
197 }); 206 });
198 207
199 test('CancelEnrollingFingerprint', function() { 208 test('CancelEnrollingFingerprint', function() {
200 assertFalse(dialog.$.dialog.open); 209 assertFalse(dialog.$.dialog.open);
201 MockInteractions.tap(fingerprintList.$$('.action-button')); 210 MockInteractions.tap(fingerprintList.$$('.action-button'));
202 return browserProxy.whenCalled('startEnroll').then(function() { 211 return browserProxy.whenCalled('startEnroll').then(function() {
(...skipping 11 matching lines...) Expand all
214 }).then(function() { 223 }).then(function() {
215 assertEquals(0, fingerprintList.fingerprints_.length); 224 assertEquals(0, fingerprintList.fingerprints_.length);
216 }); 225 });
217 }); 226 });
218 227
219 test('RemoveFingerprint', function() { 228 test('RemoveFingerprint', function() {
220 browserProxy.setFingerprints(['Label 1', 'Label 2']); 229 browserProxy.setFingerprints(['Label 1', 'Label 2']);
221 fingerprintList.updateFingerprintsList_(); 230 fingerprintList.updateFingerprintsList_();
222 231
223 return browserProxy.whenCalled('getFingerprintsList').then(function() { 232 return browserProxy.whenCalled('getFingerprintsList').then(function() {
233 browserProxy.resetResolver('getFingerprintsList');
224 assertEquals(2, fingerprintList.fingerprints_.length); 234 assertEquals(2, fingerprintList.fingerprints_.length);
225 fingerprintList.onFingerprintDeleteTapped_(createFakeEvent(0)); 235 fingerprintList.onFingerprintDeleteTapped_(createFakeEvent(0));
226 236
227 return Promise.all([ 237 return Promise.all([
228 browserProxy.whenCalled('removeEnrollment'), 238 browserProxy.whenCalled('removeEnrollment'),
229 browserProxy.whenCalled('getFingerprintsList')]); 239 browserProxy.whenCalled('getFingerprintsList')]);
230 }).then(function() { 240 }).then(function() {
231 assertEquals(1, fingerprintList.fingerprints_.length); 241 assertEquals(1, fingerprintList.fingerprints_.length);
232 }); 242 });
233 }); 243 });
(...skipping 16 matching lines...) Expand all
250 }); 260 });
251 }); 261 });
252 262
253 test('AddingNewFingerprint', function() { 263 test('AddingNewFingerprint', function() {
254 browserProxy.setFingerprints(['1', '2', '3', '4', '5']); 264 browserProxy.setFingerprints(['1', '2', '3', '4', '5']);
255 fingerprintList.updateFingerprintsList_(); 265 fingerprintList.updateFingerprintsList_();
256 266
257 // Verify that new fingerprints cannot be added when there are already five 267 // Verify that new fingerprints cannot be added when there are already five
258 // registered fingerprints. 268 // registered fingerprints.
259 return browserProxy.whenCalled('getFingerprintsList').then(function() { 269 return browserProxy.whenCalled('getFingerprintsList').then(function() {
270 browserProxy.resetResolver('getFingerprintsList');
260 assertEquals(5, fingerprintList.fingerprints_.length); 271 assertEquals(5, fingerprintList.fingerprints_.length);
261 assertTrue(fingerprintList.$$('.action-button').disabled); 272 assertTrue(fingerprintList.$$('.action-button').disabled);
262 fingerprintList.onFingerprintDeleteTapped_(createFakeEvent(0)); 273 fingerprintList.onFingerprintDeleteTapped_(createFakeEvent(0));
263 274
264 return Promise.all([ 275 return Promise.all([
265 browserProxy.whenCalled('removeEnrollment'), 276 browserProxy.whenCalled('removeEnrollment'),
266 browserProxy.whenCalled('getFingerprintsList')]); 277 browserProxy.whenCalled('getFingerprintsList')]);
267 }).then(function() { 278 }).then(function() {
268 assertEquals(4, fingerprintList.fingerprints_.length); 279 assertEquals(4, fingerprintList.fingerprints_.length);
269 assertFalse( 280 assertFalse(
270 fingerprintList.$$('.action-button').disabled); 281 fingerprintList.$$('.action-button').disabled);
271 }); 282 });
272 }); 283 });
273 }); 284 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698