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 /** @inheritDoc */ |
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', |
35 'importPersonalCertificate', | 35 'importPersonalCertificate', |
36 'importCaCertificate', | 36 'importCaCertificate', |
37 'exportCertificate', | 37 'exportCertificate', |
38 'deleteCertificate', | 38 'deleteCertificate', |
39 'populateCertificateManager', | 39 'populateCertificateManager', |
40 'viewCertificate', | 40 'viewCertificate', |
41 ]); | 41 ]); |
42 }, | 42 }, |
43 }; | 43 }; |
44 | 44 |
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 /** @inheritDoc */ |
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 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 CertificateManager.onModelReady(true /* userDbAvailable*/, | 134 CertificateManager.onModelReady(true /* userDbAvailable*/, |
135 true /* tpmAvailable */); | 135 true /* tpmAvailable */); |
136 expectFalse($('personalCertsTab-import-and-bind').disabled); | 136 expectFalse($('personalCertsTab-import-and-bind').disabled); |
137 } | 137 } |
138 }); | 138 }); |
139 | 139 |
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 /** @inheritDoc */ |
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; |
(...skipping 116 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 |