Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_browsertest.js

Issue 193273002: Handle cases when user cert database has NULL slots (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 expectTrue($('caCertsTab-export').disabled); 87 expectTrue($('caCertsTab-export').disabled);
88 expectTrue($('caCertsTab-delete').disabled); 88 expectTrue($('caCertsTab-delete').disabled);
89 expectTrue($('caCertsTab-import').disabled); 89 expectTrue($('caCertsTab-import').disabled);
90 90
91 expectTrue($('otherCertsTab-view').disabled); 91 expectTrue($('otherCertsTab-view').disabled);
92 expectTrue($('otherCertsTab-export').disabled); 92 expectTrue($('otherCertsTab-export').disabled);
93 expectTrue($('otherCertsTab-delete').disabled); 93 expectTrue($('otherCertsTab-delete').disabled);
94 94
95 Mock4JS.verifyAllMocks(); 95 Mock4JS.verifyAllMocks();
96 96
97 // If user database is not available, import buttons should be disabled.
98 CertificateManager.onModelReady(false /* userDbAvailable*/,
99 false /* tpmAvailable */);
100
101 expectTrue($('personalCertsTab-import').disabled);
102 expectTrue($('serverCertsTab-import').disabled);
103 expectTrue($('caCertsTab-import').disabled);
104
97 // Once we get the onModelReady call, the import buttons should be enabled, 105 // Once we get the onModelReady call, the import buttons should be enabled,
98 // others should still be disabled. 106 // others should still be disabled.
99 CertificateManager.onModelReady(false /* tpm_available */); 107 CertificateManager.onModelReady(true /* userDbAvailable*/,
108 false /* tpmAvailable */);
100 109
101 expectTrue($('personalCertsTab-view').disabled); 110 expectTrue($('personalCertsTab-view').disabled);
102 expectTrue($('personalCertsTab-backup').disabled); 111 expectTrue($('personalCertsTab-backup').disabled);
103 expectTrue($('personalCertsTab-delete').disabled); 112 expectTrue($('personalCertsTab-delete').disabled);
104 expectFalse($('personalCertsTab-import').disabled); 113 expectFalse($('personalCertsTab-import').disabled);
105 114
106 expectTrue($('serverCertsTab-view').disabled); 115 expectTrue($('serverCertsTab-view').disabled);
107 expectTrue($('serverCertsTab-export').disabled); 116 expectTrue($('serverCertsTab-export').disabled);
108 expectTrue($('serverCertsTab-delete').disabled); 117 expectTrue($('serverCertsTab-delete').disabled);
109 expectFalse($('serverCertsTab-import').disabled); 118 expectFalse($('serverCertsTab-import').disabled);
110 119
111 expectTrue($('caCertsTab-view').disabled); 120 expectTrue($('caCertsTab-view').disabled);
112 expectTrue($('caCertsTab-edit').disabled); 121 expectTrue($('caCertsTab-edit').disabled);
113 expectTrue($('caCertsTab-export').disabled); 122 expectTrue($('caCertsTab-export').disabled);
114 expectTrue($('caCertsTab-delete').disabled); 123 expectTrue($('caCertsTab-delete').disabled);
115 expectFalse($('caCertsTab-import').disabled); 124 expectFalse($('caCertsTab-import').disabled);
116 125
117 expectTrue($('otherCertsTab-view').disabled); 126 expectTrue($('otherCertsTab-view').disabled);
118 expectTrue($('otherCertsTab-export').disabled); 127 expectTrue($('otherCertsTab-export').disabled);
119 expectTrue($('otherCertsTab-delete').disabled); 128 expectTrue($('otherCertsTab-delete').disabled);
120 129
121 // On ChromeOS, the import and bind button should only be enabled if TPM is 130 // On ChromeOS, the import and bind button should only be enabled if TPM is
122 // present. 131 // present.
123 if (this.isChromeOS) { 132 if (this.isChromeOS) {
124 expectTrue($('personalCertsTab-import-and-bind').disabled); 133 expectTrue($('personalCertsTab-import-and-bind').disabled);
125 CertificateManager.onModelReady(true /* tpm_available */); 134 CertificateManager.onModelReady(true /* userDbAvailable*/,
135 true /* tpmAvailable */);
126 expectFalse($('personalCertsTab-import-and-bind').disabled); 136 expectFalse($('personalCertsTab-import-and-bind').disabled);
127 } 137 }
128 }); 138 });
129 139
130 /** 140 /**
131 * TestFixture for certificate manager WebUI testing. 141 * TestFixture for certificate manager WebUI testing.
132 * @extends {CertificateManagerWebUIBaseTest} 142 * @extends {CertificateManagerWebUIBaseTest}
133 * @constructor 143 * @constructor
134 **/ 144 **/
135 function CertificateManagerWebUITest() {} 145 function CertificateManagerWebUITest() {}
136 146
137 CertificateManagerWebUITest.prototype = { 147 CertificateManagerWebUITest.prototype = {
138 __proto__: CertificateManagerWebUIBaseTest.prototype, 148 __proto__: CertificateManagerWebUIBaseTest.prototype,
139 149
140 /** @inheritDoc */ 150 /** @inheritDoc */
141 preLoad: function() { 151 preLoad: function() {
142 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this); 152 CertificateManagerWebUIBaseTest.prototype.preLoad.call(this);
143 153
144 var tpm_available = this.isChromeOS; 154 var tpmAvailable = this.isChromeOS;
155 var userDbAvailable = true;
145 this.mockHandler.expects(once()).populateCertificateManager().will( 156 this.mockHandler.expects(once()).populateCertificateManager().will(
146 callFunction(function() { 157 callFunction(function() {
147 CertificateManager.onModelReady(tpm_available); 158 CertificateManager.onModelReady(userDbAvailable, tpmAvailable);
148 159
149 [['personalCertsTab-tree', 160 [['personalCertsTab-tree',
150 [{'id': 'o1', 161 [{'id': 'o1',
151 'name': 'org1', 162 'name': 'org1',
152 'subnodes': [{ 'id': 'c1', 163 'subnodes': [{ 'id': 'c1',
153 'name': 'cert1', 164 'name': 'cert1',
154 'readonly': false, 165 'readonly': false,
155 'untrusted': false, 166 'untrusted': false,
156 'extractable': true }], 167 'extractable': true }],
157 }], 168 }],
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // edit and delete buttons should be disabled. 271 // edit and delete buttons should be disabled.
261 var cert1 = certs[1]; 272 var cert1 = certs[1];
262 expectEquals('ca_cert1', cert1.data.name); 273 expectEquals('ca_cert1', cert1.data.name);
263 expectNotEquals(null, cert1.querySelector('.cert-policy')); 274 expectNotEquals(null, cert1.querySelector('.cert-policy'));
264 cert1.click(); 275 cert1.click();
265 expectTrue($('caCertsTab-edit').disabled); 276 expectTrue($('caCertsTab-edit').disabled);
266 expectTrue($('caCertsTab-delete').disabled); 277 expectTrue($('caCertsTab-delete').disabled);
267 }); 278 });
268 279
269 GEN('#endif // defined(USE_NSS)'); 280 GEN('#endif // defined(USE_NSS)');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698