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

Side by Side Diff: chrome/browser/resources/certificate_viewer.js

Issue 10382145: Fix for broken CertificateViewerUITest.testDetails. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: With test to not delay during testing. Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/test/data/webui/certificate_viewer_dialog_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cr.define('cert_viewer', function() { 5 cr.define('cert_viewer', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Initialize the certificate viewer dialog by wiring up the close button, 9 * Initialize the certificate viewer dialog by wiring up the close button,
10 * substituting in translated strings and requesting certificate details. 10 * substituting in translated strings and requesting certificate details.
11 */ 11 */
12 function initialize() { 12 function initialize() {
13 cr.ui.decorate('tabbox', cr.ui.TabBox); 13 cr.ui.decorate('tabbox', cr.ui.TabBox);
14 14
15 i18nTemplate.process(document, templateData); 15 i18nTemplate.process(document, templateData);
16 16
17 var args = JSON.parse(chrome.dialogArguments); 17 var args = JSON.parse(chrome.dialogArguments);
18 getCertificateInfo(args); 18 getCertificateInfo(args);
19 19
20 // The second tab's contents aren't visible on startup, so we can 20 // The second tab's contents aren't visible on startup, so we can
21 // shorten startup by not populating those controls until after we 21 // shorten startup by not populating those controls until after we
22 // have had a chance to draw the visible controls the first time. 22 // have had a chance to draw the visible controls the first time.
23 // The value of 200ms is quick enough that the user couldn't open the 23 // The value of 200ms is quick enough that the user couldn't open the
24 // tab in that time but long enough to allow the first tab to draw on 24 // tab in that time but long enough to allow the first tab to draw on
25 // even the slowest machine. 25 // even the slowest machine.
26 setTimeout(function() { 26
27 function initSecondTab() {
27 initializeTree($('hierarchy'), showCertificateFields); 28 initializeTree($('hierarchy'), showCertificateFields);
28 initializeTree($('cert-fields'), showCertificateFieldValue); 29 initializeTree($('cert-fields'), showCertificateFieldValue);
29 createCertificateHierarchy(args.hierarchy); 30 createCertificateHierarchy(args.hierarchy);
30 }, 200); 31 }
32
33 // When running as a unit-test, don't delay because it introduces
34 // a race-condition and makes the test flakey.
flackr 2012/05/17 02:28:16 It seems to me like the ideal way to fix this woul
35 if (typeof CertificateViewerUITest !== 'undefined')
36 initSecondTab();
37 else
38 setTimeout(initSecondTab, 200);
31 39
32 stripGtkAccessorKeys(); 40 stripGtkAccessorKeys();
33 41
34 $('export').onclick = exportCertificate; 42 $('export').onclick = exportCertificate;
35 43
36 // TODO(kochi): ESC key should be handled in the views window side. 44 // TODO(kochi): ESC key should be handled in the views window side.
37 document.addEventListener('keydown', function(e) { 45 document.addEventListener('keydown', function(e) {
38 if (e.keyCode == 27) // ESC 46 if (e.keyCode == 27) // ESC
39 chrome.send('DialogClose'); 47 chrome.send('DialogClose');
40 }); 48 });
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 chrome.send('exportCertificate', [item.detail.payload.index]); 192 chrome.send('exportCertificate', [item.detail.payload.index]);
185 } 193 }
186 194
187 return { 195 return {
188 initialize: initialize, 196 initialize: initialize,
189 getCertificateFields: getCertificateFields, 197 getCertificateFields: getCertificateFields,
190 }; 198 };
191 }); 199 });
192 200
193 document.addEventListener('DOMContentLoaded', cert_viewer.initialize); 201 document.addEventListener('DOMContentLoaded', cert_viewer.initialize);
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/certificate_viewer_dialog_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698