| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Mac and Windows go to native certificate manager, and certificate manager | 5 // Mac and Windows go to native certificate manager, and certificate manager |
| 6 // isn't implemented if OpenSSL is used. | 6 // isn't implemented if OpenSSL is used. |
| 7 GEN('#if defined(USE_NSS)'); | 7 GEN('#if defined(USE_NSS)'); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * TestFixture for certificate manager WebUI testing. | 10 * TestFixture for certificate manager WebUI testing. |
| 11 * @extends {testing.Test} | 11 * @extends {testing.Test} |
| 12 * @constructor | 12 * @constructor |
| 13 **/ | 13 **/ |
| 14 function CertificateManagerWebUIBaseTest() {} | 14 function CertificateManagerWebUIBaseTest() {} |
| 15 | 15 |
| 16 CertificateManagerWebUIBaseTest.prototype = { | 16 CertificateManagerWebUIBaseTest.prototype = { |
| 17 __proto__: testing.Test.prototype, | 17 __proto__: testing.Test.prototype, |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Browse to the certificate manager. | 20 * Browse to the certificate manager. |
| 21 **/ | 21 **/ |
| 22 browsePreload: 'chrome://settings-frame/certificates', | 22 browsePreload: 'chrome://settings-frame/certificates', |
| 23 | 23 |
| 24 /** @inheritDoc */ | 24 /** @override */ |
| 25 preLoad: function() { | 25 preLoad: function() { |
| 26 // We can't check cr.isChromeOS in the preLoad since "cr" doesn't exist yet. | 26 // We can't check cr.isChromeOS in the preLoad since "cr" doesn't exist yet. |
| 27 // This is copied from ui/webui/resources/js/cr.js, maybe | 27 // This is copied from ui/webui/resources/js/cr.js, maybe |
| 28 // there's a better way to do this. | 28 // there's a better way to do this. |
| 29 this.isChromeOS = /CrOS/.test(navigator.userAgent); | 29 this.isChromeOS = /CrOS/.test(navigator.userAgent); |
| 30 | 30 |
| 31 this.makeAndRegisterMockHandler( | 31 this.makeAndRegisterMockHandler( |
| 32 [ | 32 [ |
| 33 'editCaCertificateTrust', | 33 'editCaCertificateTrust', |
| 34 'exportPersonalCertificate', | 34 'exportPersonalCertificate', |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 /** | 45 /** |
| 46 * TestFixture for certificate manager WebUI testing. | 46 * TestFixture for certificate manager WebUI testing. |
| 47 * @extends {CertificateManagerWebUIBaseTest} | 47 * @extends {CertificateManagerWebUIBaseTest} |
| 48 * @constructor | 48 * @constructor |
| 49 **/ | 49 **/ |
| 50 function CertificateManagerWebUIUnpopulatedTest() {} | 50 function CertificateManagerWebUIUnpopulatedTest() {} |
| 51 | 51 |
| 52 CertificateManagerWebUIUnpopulatedTest.prototype = { | 52 CertificateManagerWebUIUnpopulatedTest.prototype = { |
| 53 __proto__: CertificateManagerWebUIBaseTest.prototype, | 53 __proto__: CertificateManagerWebUIBaseTest.prototype, |
| 54 | 54 |
| 55 /** @inheritDoc */ | 55 /** @override */ |
| 56 preLoad: function() { | 56 preLoad: function() { |
| 57 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this); | 57 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this); |
| 58 | 58 |
| 59 // We expect the populateCertificateManager callback, but do not reply to | 59 // We expect the populateCertificateManager callback, but do not reply to |
| 60 // it. This simulates what will be displayed if retrieving the cert list | 60 // it. This simulates what will be displayed if retrieving the cert list |
| 61 // from NSS is slow. | 61 // from NSS is slow. |
| 62 this.mockHandler.expects(once()).populateCertificateManager(); | 62 this.mockHandler.expects(once()).populateCertificateManager(); |
| 63 }, | 63 }, |
| 64 }; | 64 }; |
| 65 | 65 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 /** | 140 /** |
| 141 * TestFixture for certificate manager WebUI testing. | 141 * TestFixture for certificate manager WebUI testing. |
| 142 * @extends {CertificateManagerWebUIBaseTest} | 142 * @extends {CertificateManagerWebUIBaseTest} |
| 143 * @constructor | 143 * @constructor |
| 144 **/ | 144 **/ |
| 145 function CertificateManagerWebUITest() {} | 145 function CertificateManagerWebUITest() {} |
| 146 | 146 |
| 147 CertificateManagerWebUITest.prototype = { | 147 CertificateManagerWebUITest.prototype = { |
| 148 __proto__: CertificateManagerWebUIBaseTest.prototype, | 148 __proto__: CertificateManagerWebUIBaseTest.prototype, |
| 149 | 149 |
| 150 /** @inheritDoc */ | 150 /** @override */ |
| 151 preLoad: function() { | 151 preLoad: function() { |
| 152 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this); | 152 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this); |
| 153 | 153 |
| 154 var tpmAvailable = this.isChromeOS; | 154 var tpmAvailable = this.isChromeOS; |
| 155 var userDbAvailable = true; | 155 var userDbAvailable = true; |
| 156 this.mockHandler.expects(once()).populateCertificateManager().will( | 156 this.mockHandler.expects(once()).populateCertificateManager().will( |
| 157 callFunction(function() { | 157 callFunction(function() { |
| 158 CertificateManager.onModelReady(userDbAvailable, tpmAvailable); | 158 CertificateManager.onModelReady(userDbAvailable, tpmAvailable); |
| 159 | 159 |
| 160 [['personalCertsTab-tree', | 160 [['personalCertsTab-tree', |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // edit and delete buttons should be disabled. | 271 // edit and delete buttons should be disabled. |
| 272 var cert1 = certs[1]; | 272 var cert1 = certs[1]; |
| 273 expectEquals('ca_cert1', cert1.data.name); | 273 expectEquals('ca_cert1', cert1.data.name); |
| 274 expectNotEquals(null, cert1.querySelector('.cert-policy')); | 274 expectNotEquals(null, cert1.querySelector('.cert-policy')); |
| 275 cert1.click(); | 275 cert1.click(); |
| 276 expectTrue($('caCertsTab-edit').disabled); | 276 expectTrue($('caCertsTab-edit').disabled); |
| 277 expectTrue($('caCertsTab-delete').disabled); | 277 expectTrue($('caCertsTab-delete').disabled); |
| 278 }); | 278 }); |
| 279 | 279 |
| 280 GEN('#endif // defined(USE_NSS)'); | 280 GEN('#endif // defined(USE_NSS)'); |
| OLD | NEW |