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

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

Issue 2092763004: [MD Settings] Implement search in material design passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: indexOf -> includes Created 4 years, 5 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 | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Runs the Polymer Password Settings tests. */ 5 /** @fileoverview Runs the Polymer Password Settings tests. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 var passwordDialog = document.createElement('password-edit-dialog'); 122 var passwordDialog = document.createElement('password-edit-dialog');
123 passwordDialog.item = passwordItem; 123 passwordDialog.item = passwordItem;
124 document.body.appendChild(passwordDialog); 124 document.body.appendChild(passwordDialog);
125 Polymer.dom.flush(); 125 Polymer.dom.flush();
126 return passwordDialog; 126 return passwordDialog;
127 }, 127 },
128 128
129 /** 129 /**
130 * Helper method used to test for a url in a list of passwords. 130 * Helper method used to test for a url in a list of passwords.
131 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList 131 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList
132 * @param {!string} url The URL that is being searched for. 132 * @param {string} url The URL that is being searched for.
133 */ 133 */
134 listContainsUrl(passwordList, url) { 134 listContainsUrl(passwordList, url) {
135 for (var i = 0; i < passwordList.length; ++i) { 135 for (var i = 0; i < passwordList.length; ++i) {
136 if (passwordList[i].loginPair.originUrl == url) 136 if (passwordList[i].loginPair.originUrl == url)
137 return true; 137 return true;
138 } 138 }
139 return false; 139 return false;
140 }, 140 },
141 141
142 /** 142 /**
143 * Helper method used to test for a url in a list of passwords. 143 * Helper method used to test for a url in a list of passwords.
144 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList 144 * @param {!Array<!chrome.passwordsPrivate.ExceptionPair>} exceptionList
145 * @param {!string} url The URL that is being searched for. 145 * @param {string} url The URL that is being searched for.
146 */ 146 */
147 exceptionsListContainsUrl(exceptionList, url) { 147 exceptionsListContainsUrl(exceptionList, url) {
148 for (var i = 0; i < exceptionList.length; ++i) { 148 for (var i = 0; i < exceptionList.length; ++i) {
149 if (exceptionList[i].exceptionUrl == url) 149 if (exceptionList[i].exceptionUrl == url)
150 return true; 150 return true;
151 } 151 }
152 return false; 152 return false;
153 }, 153 },
154 154
155 /** 155 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 window.setTimeout(clickRemoveButton, 0); 261 window.setTimeout(clickRemoveButton, 0);
262 } else { 262 } else {
263 done(); 263 done();
264 } 264 }
265 }); 265 });
266 266
267 // Start removing. 267 // Start removing.
268 clickRemoveButton(); 268 clickRemoveButton();
269 }); 269 });
270 270
271 test('verifyFilterPasswords', function() {
272 var passwordList = [
273 FakeDataMaker.passwordEntry('one.com', 'show', 5),
274 FakeDataMaker.passwordEntry('two.com', 'shower', 3),
275 FakeDataMaker.passwordEntry('three.com/show', 'four', 1),
276 FakeDataMaker.passwordEntry('four.com', 'three', 2),
277 FakeDataMaker.passwordEntry('five.com', 'two', 4),
278 FakeDataMaker.passwordEntry('six-show.com', 'one', 6),
279 ];
280
281 var passwordsSection = self.createPasswordsSection_(passwordList, []);
282 passwordsSection.filter = 'show';
283 Polymer.dom.flush();
284
285 var expectedPasswordList = [
286 FakeDataMaker.passwordEntry('one.com', 'show', 5),
287 FakeDataMaker.passwordEntry('two.com', 'shower', 3),
288 FakeDataMaker.passwordEntry('three.com/show', 'four', 1),
289 FakeDataMaker.passwordEntry('six-show.com', 'one', 6),
290 ];
291
292 self.validatePasswordList(
293 self.getIronListChildren_(passwordsSection.$.passwordList),
294 expectedPasswordList);
295 });
296
297 test('verifyFilterPasswordExceptions', function() {
298 var exceptionList = [
299 FakeDataMaker.exceptionEntry('docsshow.google.com'),
300 FakeDataMaker.exceptionEntry('showmail.com'),
301 FakeDataMaker.exceptionEntry('google.com'),
302 FakeDataMaker.exceptionEntry('inbox.google.com'),
303 FakeDataMaker.exceptionEntry('mapsshow.google.com'),
304 FakeDataMaker.exceptionEntry('plus.google.comshow'),
305 ];
306
307 var passwordsSection = self.createPasswordsSection_([], exceptionList);
308 passwordsSection.filter = 'show';
309 Polymer.dom.flush();
310
311 var expectedExceptionList = [
312 FakeDataMaker.exceptionEntry('docsshow.google.com'),
313 FakeDataMaker.exceptionEntry('showmail.com'),
314 FakeDataMaker.exceptionEntry('mapsshow.google.com'),
315 FakeDataMaker.exceptionEntry('plus.google.comshow'),
316 ];
317
318 self.validateExceptionList_(
319 self.getIronListChildren_(passwordsSection.$.passwordExceptionsList),
320 expectedExceptionList);
321 });
322
271 test('verifyPasswordExceptions', function() { 323 test('verifyPasswordExceptions', function() {
272 var exceptionList = [ 324 var exceptionList = [
273 FakeDataMaker.exceptionEntry('docs.google.com'), 325 FakeDataMaker.exceptionEntry('docs.google.com'),
274 FakeDataMaker.exceptionEntry('mail.com'), 326 FakeDataMaker.exceptionEntry('mail.com'),
275 FakeDataMaker.exceptionEntry('google.com'), 327 FakeDataMaker.exceptionEntry('google.com'),
276 FakeDataMaker.exceptionEntry('inbox.google.com'), 328 FakeDataMaker.exceptionEntry('inbox.google.com'),
277 FakeDataMaker.exceptionEntry('maps.google.com'), 329 FakeDataMaker.exceptionEntry('maps.google.com'),
278 FakeDataMaker.exceptionEntry('plus.google.com'), 330 FakeDataMaker.exceptionEntry('plus.google.com'),
279 ]; 331 ];
280 332
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 assertEquals(item.loginPair.username, event.detail.username); 441 assertEquals(item.loginPair.username, event.detail.username);
390 done(); 442 done();
391 }); 443 });
392 444
393 MockInteractions.tap(passwordDialog.$.showPasswordButton); 445 MockInteractions.tap(passwordDialog.$.showPasswordButton);
394 }); 446 });
395 }); 447 });
396 448
397 mocha.run(); 449 mocha.run();
398 }); 450 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698