| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 * @private | 54 * @private |
| 55 */ | 55 */ |
| 56 function validatePasswordList(listElement, passwordList) { | 56 function validatePasswordList(listElement, passwordList) { |
| 57 assertEquals(passwordList.length, listElement.items.length); | 57 assertEquals(passwordList.length, listElement.items.length); |
| 58 if (passwordList.length > 0) { | 58 if (passwordList.length > 0) { |
| 59 // The first child is a template, skip and get the real 'first child'. | 59 // The first child is a template, skip and get the real 'first child'. |
| 60 var node = Polymer.dom(listElement).children[1]; | 60 var node = Polymer.dom(listElement).children[1]; |
| 61 assert(node); | 61 assert(node); |
| 62 var passwordInfo = passwordList[0]; | 62 var passwordInfo = passwordList[0]; |
| 63 assertEquals(passwordInfo.loginPair.urls.shown, | 63 assertEquals(passwordInfo.loginPair.urls.shown, |
| 64 node.querySelector('#originUrl').textContent.trim()); | 64 node.$$('#originUrl').textContent.trim()); |
| 65 assertEquals(passwordInfo.loginPair.urls.link, | 65 assertEquals(passwordInfo.loginPair.urls.link, |
| 66 node.querySelector('#originUrl').href); | 66 node.$$('#originUrl').href); |
| 67 assertEquals(passwordInfo.loginPair.username, | 67 assertEquals(passwordInfo.loginPair.username, |
| 68 node.querySelector('#username').textContent); | 68 node.$$('#username').textContent); |
| 69 assertEquals(passwordInfo.numCharactersInPassword, | 69 assertEquals(passwordInfo.numCharactersInPassword, |
| 70 node.querySelector('#password').value.length); | 70 node.$$('#password').value.length); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Helper method that validates a that elements in the exception list match | 75 * Helper method that validates a that elements in the exception list match |
| 76 * the expected data. | 76 * the expected data. |
| 77 * @param {!Array<!Element>} nodes The nodes that will be checked. | 77 * @param {!Array<!Element>} nodes The nodes that will be checked. |
| 78 * @param {!Array<!chrome.passwordsPrivate.ExceptionEntry>} exceptionList The | 78 * @param {!Array<!chrome.passwordsPrivate.ExceptionEntry>} exceptionList The |
| 79 * expected data. | 79 * expected data. |
| 80 * @private | 80 * @private |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 assertEquals(firstPassword.loginPair.urls.origin, detail.urls.origin); | 276 assertEquals(firstPassword.loginPair.urls.origin, detail.urls.origin); |
| 277 assertEquals(firstPassword.loginPair.username, detail.username); | 277 assertEquals(firstPassword.loginPair.username, detail.username); |
| 278 | 278 |
| 279 // Clean up after self. | 279 // Clean up after self. |
| 280 passwordManager.onRemoveSavedPassword = null; | 280 passwordManager.onRemoveSavedPassword = null; |
| 281 | 281 |
| 282 done(); | 282 done(); |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 // Click the remove button on the first password. | 285 // Click the remove button on the first password. |
| 286 MockInteractions.tap(firstNode.querySelector('#passwordMenu')); | 286 MockInteractions.tap(firstNode.$$('#passwordMenu')); |
| 287 MockInteractions.tap(passwordsSection.$.menuRemovePassword); | 287 MockInteractions.tap(passwordsSection.$.menuRemovePassword); |
| 288 }); | 288 }); |
| 289 | 289 |
| 290 test('verifyFilterPasswords', function() { | 290 test('verifyFilterPasswords', function() { |
| 291 var passwordList = [ | 291 var passwordList = [ |
| 292 FakeDataMaker.passwordEntry('one.com', 'show', 5), | 292 FakeDataMaker.passwordEntry('one.com', 'show', 5), |
| 293 FakeDataMaker.passwordEntry('two.com', 'shower', 3), | 293 FakeDataMaker.passwordEntry('two.com', 'shower', 3), |
| 294 FakeDataMaker.passwordEntry('three.com/show', 'four', 1), | 294 FakeDataMaker.passwordEntry('three.com/show', 'four', 1), |
| 295 FakeDataMaker.passwordEntry('four.com', 'three', 2), | 295 FakeDataMaker.passwordEntry('four.com', 'three', 2), |
| 296 FakeDataMaker.passwordEntry('five.com', 'two', 4), | 296 FakeDataMaker.passwordEntry('five.com', 'two', 4), |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 assertEquals(item.loginPair.username, event.detail.username); | 489 assertEquals(item.loginPair.username, event.detail.username); |
| 490 done(); | 490 done(); |
| 491 }); | 491 }); |
| 492 | 492 |
| 493 MockInteractions.tap(passwordDialog.$.showPasswordButton); | 493 MockInteractions.tap(passwordDialog.$.showPasswordButton); |
| 494 }); | 494 }); |
| 495 }); | 495 }); |
| 496 | 496 |
| 497 mocha.run(); | 497 mocha.run(); |
| 498 }); | 498 }); |
| OLD | NEW |