| 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 16 matching lines...) Expand all Loading... |
| 27 /** @override */ | 27 /** @override */ |
| 28 browsePreload: | 28 browsePreload: |
| 29 'chrome://md-settings/passwords_and_forms_page/passwords_section.html', | 29 'chrome://md-settings/passwords_and_forms_page/passwords_section.html', |
| 30 | 30 |
| 31 /** @override */ | 31 /** @override */ |
| 32 extraLibraries: PolymerTest.getLibraries(ROOT_PATH), | 32 extraLibraries: PolymerTest.getLibraries(ROOT_PATH), |
| 33 | 33 |
| 34 /** @override */ | 34 /** @override */ |
| 35 setUp: function() { | 35 setUp: function() { |
| 36 PolymerTest.prototype.setUp.call(this); | 36 PolymerTest.prototype.setUp.call(this); |
| 37 PolymerTest.clearBody(); |
| 37 | 38 |
| 38 // Test is run on an individual element that won't have a page language. | 39 // Test is run on an individual element that won't have a page language. |
| 39 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing'); | 40 this.accessibilityAuditConfig.auditRulesToIgnore.push('humanLangMissing'); |
| 40 }, | 41 }, |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * Helper method that validates a that elements in the password list match | 44 * Helper method that validates a that elements in the password list match |
| 44 * the expected data. | 45 * the expected data. |
| 45 * @param {!Element} listElement The iron-list element that will be checked. | 46 * @param {!Element} listElement The iron-list element that will be checked. |
| 46 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList The | 47 * @param {!Array<!chrome.passwordsPrivate.PasswordUiEntry>} passwordList The |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 Polymer.dom.flush(); | 164 Polymer.dom.flush(); |
| 164 }, | 165 }, |
| 165 }; | 166 }; |
| 166 | 167 |
| 167 /** This test will validate that the section is loaded with data. */ | 168 /** This test will validate that the section is loaded with data. */ |
| 168 TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { | 169 TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { |
| 169 var self = this; | 170 var self = this; |
| 170 | 171 |
| 171 suite('PasswordsSection', function() { | 172 suite('PasswordsSection', function() { |
| 172 test('verifyNoSavedPasswords', function() { | 173 test('verifyNoSavedPasswords', function() { |
| 173 assertEquals(self.browsePreload, document.location.href); | |
| 174 | |
| 175 var passwordsSection = self.createPasswordsSection_([], []); | 174 var passwordsSection = self.createPasswordsSection_([], []); |
| 176 | 175 |
| 177 self.validatePasswordList(passwordsSection.$.passwordList, []); | 176 self.validatePasswordList(passwordsSection.$.passwordList, []); |
| 178 | 177 |
| 179 assertFalse(passwordsSection.$.noPasswordsLabel.hidden); | 178 assertFalse(passwordsSection.$.noPasswordsLabel.hidden); |
| 180 assertTrue(passwordsSection.$.savedPasswordsHeading.hidden); | 179 assertTrue(passwordsSection.$.savedPasswordsHeading.hidden); |
| 181 }); | 180 }); |
| 182 | 181 |
| 183 test('verifySavedPasswordLength', function() { | 182 test('verifySavedPasswordLength', function() { |
| 184 assertEquals(self.browsePreload, document.location.href); | |
| 185 | |
| 186 var passwordList = [ | 183 var passwordList = [ |
| 187 FakeDataMaker.passwordEntry('site1.com', 'luigi', 1), | 184 FakeDataMaker.passwordEntry('site1.com', 'luigi', 1), |
| 188 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), | 185 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), |
| 189 FakeDataMaker.passwordEntry('site2.com', 'mario', 70), | 186 FakeDataMaker.passwordEntry('site2.com', 'mario', 70), |
| 190 FakeDataMaker.passwordEntry('site1.com', 'peach', 11), | 187 FakeDataMaker.passwordEntry('site1.com', 'peach', 11), |
| 191 FakeDataMaker.passwordEntry('google.com', 'mario', 7), | 188 FakeDataMaker.passwordEntry('google.com', 'mario', 7), |
| 192 FakeDataMaker.passwordEntry('site2.com', 'luigi', 8), | 189 FakeDataMaker.passwordEntry('site2.com', 'luigi', 8), |
| 193 ]; | 190 ]; |
| 194 | 191 |
| 195 var passwordsSection = self.createPasswordsSection_(passwordList, []); | 192 var passwordsSection = self.createPasswordsSection_(passwordList, []); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 assertEquals(item.loginPair.username, event.detail.username); | 437 assertEquals(item.loginPair.username, event.detail.username); |
| 441 done(); | 438 done(); |
| 442 }); | 439 }); |
| 443 | 440 |
| 444 MockInteractions.tap(passwordDialog.$.showPasswordButton); | 441 MockInteractions.tap(passwordDialog.$.showPasswordButton); |
| 445 }); | 442 }); |
| 446 }); | 443 }); |
| 447 | 444 |
| 448 mocha.run(); | 445 mocha.run(); |
| 449 }); | 446 }); |
| OLD | NEW |