| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('certificate_manager_page', function() { | 5 cr.define('certificate_manager_page', function() { |
| 6 /** | 6 /** |
| 7 * A test version of CertificatesBrowserProxy. Provides helper methods | 7 * A test version of CertificatesBrowserProxy. Provides helper methods |
| 8 * for allowing tests to know when a method was called, as well as | 8 * for allowing tests to know when a method was called, as well as |
| 9 * specifying mock responses. | 9 * specifying mock responses. |
| 10 * | 10 * |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 'settings-certificate-password-decryption-dialog'); | 433 'settings-certificate-password-decryption-dialog'); |
| 434 document.body.appendChild(dialog); | 434 document.body.appendChild(dialog); |
| 435 }); | 435 }); |
| 436 | 436 |
| 437 teardown(function() { dialog.remove(); }); | 437 teardown(function() { dialog.remove(); }); |
| 438 | 438 |
| 439 test('DecryptSuccess', function() { | 439 test('DecryptSuccess', function() { |
| 440 var passwordInputElement = | 440 var passwordInputElement = |
| 441 Polymer.dom(dialog.$.dialog).querySelector('paper-input'); | 441 Polymer.dom(dialog.$.dialog).querySelector('paper-input'); |
| 442 assertTrue(dialog.$.dialog.open); | 442 assertTrue(dialog.$.dialog.open); |
| 443 assertTrue(dialog.$.ok.disabled); | |
| 444 | 443 |
| 445 // Test that the 'OK' button is disabled when the password field is | 444 // Test that the 'OK' button is enabled even when the password field is |
| 446 // empty. | 445 // empty. |
| 447 triggerInputEvent(passwordInputElement); | 446 assertEquals('', passwordInputElement.value); |
| 448 assertTrue(dialog.$.ok.disabled); | 447 assertFalse(dialog.$.ok.disabled); |
| 448 |
| 449 passwordInputElement.value = 'foopassword'; | 449 passwordInputElement.value = 'foopassword'; |
| 450 triggerInputEvent(passwordInputElement); | |
| 451 assertFalse(dialog.$.ok.disabled); | 450 assertFalse(dialog.$.ok.disabled); |
| 452 | 451 |
| 453 // Simulate clicking 'OK'. | 452 // Simulate clicking 'OK'. |
| 454 MockInteractions.tap(dialog.$.ok); | 453 MockInteractions.tap(dialog.$.ok); |
| 455 | 454 |
| 456 return browserProxy.whenCalled(methodName).then(function(password) { | 455 return browserProxy.whenCalled(methodName).then(function(password) { |
| 457 assertEquals(passwordInputElement.value, password); | 456 assertEquals(passwordInputElement.value, password); |
| 458 // Check that the dialog is closed. | 457 // Check that the dialog is closed. |
| 459 assertFalse(dialog.$.dialog.open); | 458 assertFalse(dialog.$.dialog.open); |
| 460 }); | 459 }); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 registerCaTrustEditDialogTests(); | 860 registerCaTrustEditDialogTests(); |
| 862 registerDeleteDialogTests(); | 861 registerDeleteDialogTests(); |
| 863 registerPasswordEncryptDialogTests(); | 862 registerPasswordEncryptDialogTests(); |
| 864 registerPasswordDecryptDialogTests(); | 863 registerPasswordDecryptDialogTests(); |
| 865 registerPageTests(); | 864 registerPageTests(); |
| 866 registerCertificateSubentryTests(); | 865 registerCertificateSubentryTests(); |
| 867 registerCertificateListTests(); | 866 registerCertificateListTests(); |
| 868 }, | 867 }, |
| 869 }; | 868 }; |
| 870 }); | 869 }); |
| OLD | NEW |