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

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

Issue 2850663002: MD-Settings - Add test for federated password dialog. (Closed)
Patch Set: Created 3 years, 7 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 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 passwordManager.onRemoveException = null; 437 passwordManager.onRemoveException = null;
438 438
439 done(); 439 done();
440 } 440 }
441 }; 441 };
442 442
443 // Start removing. 443 // Start removing.
444 clickRemoveButton(); 444 clickRemoveButton();
445 }); 445 });
446 446
447 test('verifyFederatedPassword', function() {
448 var item = FakeDataMaker.passwordEntry('goo.gl', 'bart', 0);
449 item.federationText = 'with chromium.org';
450 var passwordDialog = createPasswordDialog(item);
451
452 Polymer.dom.flush();
453
454 assertEquals(item.federationText,
455 passwordDialog.$.passwordInput.value);
456 // Text should be readable.
457 assertEquals('text',
458 passwordDialog.$.passwordInput.type);
459 assertTrue(passwordDialog.$.showPasswordButton.hidden);
460 });
461
447 test('showSavedPassword', function() { 462 test('showSavedPassword', function() {
448 var PASSWORD = 'bAn@n@5'; 463 var PASSWORD = 'bAn@n@5';
449 var item = FakeDataMaker.passwordEntry('goo.gl', 'bart', PASSWORD.length); 464 var item = FakeDataMaker.passwordEntry('goo.gl', 'bart', PASSWORD.length);
450 var passwordDialog = createPasswordDialog(item); 465 var passwordDialog = createPasswordDialog(item);
451 466
467 assertFalse(passwordDialog.$.showPasswordButton.hidden);
468
452 passwordDialog.password = PASSWORD; 469 passwordDialog.password = PASSWORD;
453 passwordDialog.showPassword = true; 470 passwordDialog.showPassword = true;
454 471
455 Polymer.dom.flush(); 472 Polymer.dom.flush();
456 473
457 assertEquals(PASSWORD, 474 assertEquals(PASSWORD,
458 passwordDialog.$.passwordInput.value); 475 passwordDialog.$.passwordInput.value);
459 // Password should be visible. 476 // Password should be visible.
460 assertEquals('text', 477 assertEquals('text',
461 passwordDialog.$.passwordInput.type); 478 passwordDialog.$.passwordInput.type);
479 assertFalse(passwordDialog.$.showPasswordButton.hidden);
462 }); 480 });
463 481
464 // Test will timeout if event is not received. 482 // Test will timeout if event is not received.
465 test('onShowSavedPassword', function(done) { 483 test('onShowSavedPassword', function(done) {
466 var item = FakeDataMaker.passwordEntry('goo.gl', 'bart', 1); 484 var item = FakeDataMaker.passwordEntry('goo.gl', 'bart', 1);
467 var passwordDialog = createPasswordDialog(item); 485 var passwordDialog = createPasswordDialog(item);
468 486
469 passwordDialog.addEventListener('show-password', function(event) { 487 passwordDialog.addEventListener('show-password', function(event) {
470 assertEquals(item.loginPair.urls.origin, event.detail.urls.origin); 488 assertEquals(item.loginPair.urls.origin, event.detail.urls.origin);
471 assertEquals(item.loginPair.username, event.detail.username); 489 assertEquals(item.loginPair.username, event.detail.username);
472 done(); 490 done();
473 }); 491 });
474 492
475 MockInteractions.tap(passwordDialog.$.showPasswordButton); 493 MockInteractions.tap(passwordDialog.$.showPasswordButton);
476 }); 494 });
477 }); 495 });
478 496
479 mocha.run(); 497 mocha.run();
480 }); 498 });
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