| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 }, | 176 }, |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * This test will validate that the section is loaded with data. | 180 * This test will validate that the section is loaded with data. |
| 181 */ | 181 */ |
| 182 TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { | 182 TEST_F('SettingsPasswordSectionBrowserTest', 'uiTests', function() { |
| 183 var self = this; | 183 var self = this; |
| 184 | 184 |
| 185 suite('PasswordsSection', function() { | 185 suite('PasswordsSection', function() { |
| 186 test('verifyNoSavedPasswords', function() { |
| 187 assertEquals(self.browsePreload, document.location.href); |
| 188 |
| 189 var passwordsSection = self.createPasswordsSection_([], []); |
| 190 |
| 191 self.validatePasswordList( |
| 192 self.getIronListChildren_(passwordsSection.$.passwordList), |
| 193 []); |
| 194 |
| 195 assertFalse(passwordsSection.$.noPasswordsLabel.hidden); |
| 196 assertTrue(passwordsSection.$.savedPasswordsHeading.hidden); |
| 197 }); |
| 198 |
| 186 test('verifySavedPasswordLength', function() { | 199 test('verifySavedPasswordLength', function() { |
| 187 assertEquals(self.browsePreload, document.location.href); | 200 assertEquals(self.browsePreload, document.location.href); |
| 188 | 201 |
| 189 var passwordList = [ | 202 var passwordList = [ |
| 190 FakeDataMaker.passwordEntry('site1.com', 'luigi', 1), | 203 FakeDataMaker.passwordEntry('site1.com', 'luigi', 1), |
| 191 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), | 204 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), |
| 192 FakeDataMaker.passwordEntry('site2.com', 'mario', 70), | 205 FakeDataMaker.passwordEntry('site2.com', 'mario', 70), |
| 193 FakeDataMaker.passwordEntry('site1.com', 'peach', 11), | 206 FakeDataMaker.passwordEntry('site1.com', 'peach', 11), |
| 194 FakeDataMaker.passwordEntry('google.com', 'mario', 7), | 207 FakeDataMaker.passwordEntry('google.com', 'mario', 7), |
| 195 FakeDataMaker.passwordEntry('site2.com', 'luigi', 8), | 208 FakeDataMaker.passwordEntry('site2.com', 'luigi', 8), |
| 196 ]; | 209 ]; |
| 197 | 210 |
| 198 var passwordsSection = self.createPasswordsSection_(passwordList, []); | 211 var passwordsSection = self.createPasswordsSection_(passwordList, []); |
| 199 | 212 |
| 200 // Assert that the data is passed into the iron list. If this fails, | 213 // Assert that the data is passed into the iron list. If this fails, |
| 201 // then other expectations will also fail. | 214 // then other expectations will also fail. |
| 202 assertEquals(passwordList, passwordsSection.$.passwordList.items); | 215 assertEquals(passwordList, passwordsSection.$.passwordList.items); |
| 203 | 216 |
| 204 self.validatePasswordList( | 217 self.validatePasswordList( |
| 205 self.getIronListChildren_(passwordsSection.$.passwordList), | 218 self.getIronListChildren_(passwordsSection.$.passwordList), |
| 206 passwordList); | 219 passwordList); |
| 220 |
| 221 assertTrue(passwordsSection.$.noPasswordsLabel.hidden); |
| 222 assertFalse(passwordsSection.$.savedPasswordsHeading.hidden); |
| 207 }); | 223 }); |
| 208 | 224 |
| 209 // Test verifies that removing a password will update the elements. | 225 // Test verifies that removing a password will update the elements. |
| 210 test('verifyPasswordListRemove', function() { | 226 test('verifyPasswordListRemove', function() { |
| 211 var passwordList = [ | 227 var passwordList = [ |
| 212 FakeDataMaker.passwordEntry('anotherwebsite.com', 'luigi', 1), | 228 FakeDataMaker.passwordEntry('anotherwebsite.com', 'luigi', 1), |
| 213 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), | 229 FakeDataMaker.passwordEntry('longwebsite.com', 'peach', 7), |
| 214 FakeDataMaker.passwordEntry('website.com', 'mario', 70) | 230 FakeDataMaker.passwordEntry('website.com', 'mario', 70) |
| 215 ]; | 231 ]; |
| 216 | 232 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 FakeDataMaker.exceptionEntry('showmail.com'), | 341 FakeDataMaker.exceptionEntry('showmail.com'), |
| 326 FakeDataMaker.exceptionEntry('mapsshow.google.com'), | 342 FakeDataMaker.exceptionEntry('mapsshow.google.com'), |
| 327 FakeDataMaker.exceptionEntry('plus.google.comshow'), | 343 FakeDataMaker.exceptionEntry('plus.google.comshow'), |
| 328 ]; | 344 ]; |
| 329 | 345 |
| 330 self.validateExceptionList_( | 346 self.validateExceptionList_( |
| 331 self.getDomRepeatChildren_(passwordsSection.$.passwordExceptionsList), | 347 self.getDomRepeatChildren_(passwordsSection.$.passwordExceptionsList), |
| 332 expectedExceptionList); | 348 expectedExceptionList); |
| 333 }); | 349 }); |
| 334 | 350 |
| 351 test('verifyNoPasswordExceptions', function() { |
| 352 var passwordsSection = self.createPasswordsSection_([], []); |
| 353 |
| 354 self.validateExceptionList_( |
| 355 self.getDomRepeatChildren_(passwordsSection.$.passwordExceptionsList), |
| 356 []); |
| 357 |
| 358 assertFalse(passwordsSection.$.noExceptionsLabel.hidden); |
| 359 }); |
| 360 |
| 335 test('verifyPasswordExceptions', function() { | 361 test('verifyPasswordExceptions', function() { |
| 336 var exceptionList = [ | 362 var exceptionList = [ |
| 337 FakeDataMaker.exceptionEntry('docs.google.com'), | 363 FakeDataMaker.exceptionEntry('docs.google.com'), |
| 338 FakeDataMaker.exceptionEntry('mail.com'), | 364 FakeDataMaker.exceptionEntry('mail.com'), |
| 339 FakeDataMaker.exceptionEntry('google.com'), | 365 FakeDataMaker.exceptionEntry('google.com'), |
| 340 FakeDataMaker.exceptionEntry('inbox.google.com'), | 366 FakeDataMaker.exceptionEntry('inbox.google.com'), |
| 341 FakeDataMaker.exceptionEntry('maps.google.com'), | 367 FakeDataMaker.exceptionEntry('maps.google.com'), |
| 342 FakeDataMaker.exceptionEntry('plus.google.com'), | 368 FakeDataMaker.exceptionEntry('plus.google.com'), |
| 343 ]; | 369 ]; |
| 344 | 370 |
| 345 var passwordsSection = self.createPasswordsSection_([], exceptionList); | 371 var passwordsSection = self.createPasswordsSection_([], exceptionList); |
| 346 | 372 |
| 347 self.validateExceptionList_( | 373 self.validateExceptionList_( |
| 348 self.getDomRepeatChildren_(passwordsSection.$.passwordExceptionsList), | 374 self.getDomRepeatChildren_(passwordsSection.$.passwordExceptionsList), |
| 349 exceptionList); | 375 exceptionList); |
| 376 |
| 377 assertTrue(passwordsSection.$.noExceptionsLabel.hidden); |
| 350 }); | 378 }); |
| 351 | 379 |
| 352 // Test verifies that removing an exception will update the elements. | 380 // Test verifies that removing an exception will update the elements. |
| 353 test('verifyPasswordExceptionRemove', function() { | 381 test('verifyPasswordExceptionRemove', function() { |
| 354 var exceptionList = [ | 382 var exceptionList = [ |
| 355 FakeDataMaker.exceptionEntry('docs.google.com'), | 383 FakeDataMaker.exceptionEntry('docs.google.com'), |
| 356 FakeDataMaker.exceptionEntry('mail.com'), | 384 FakeDataMaker.exceptionEntry('mail.com'), |
| 357 FakeDataMaker.exceptionEntry('google.com'), | 385 FakeDataMaker.exceptionEntry('google.com'), |
| 358 FakeDataMaker.exceptionEntry('inbox.google.com'), | 386 FakeDataMaker.exceptionEntry('inbox.google.com'), |
| 359 FakeDataMaker.exceptionEntry('maps.google.com'), | 387 FakeDataMaker.exceptionEntry('maps.google.com'), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 assertEquals(item.loginPair.username, event.detail.username); | 476 assertEquals(item.loginPair.username, event.detail.username); |
| 449 done(); | 477 done(); |
| 450 }); | 478 }); |
| 451 | 479 |
| 452 MockInteractions.tap(passwordDialog.$.showPasswordButton); | 480 MockInteractions.tap(passwordDialog.$.showPasswordButton); |
| 453 }); | 481 }); |
| 454 }); | 482 }); |
| 455 | 483 |
| 456 mocha.run(); | 484 mocha.run(); |
| 457 }); | 485 }); |
| OLD | NEW |