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

Side by Side Diff: chrome/test/data/webui/certificate_viewer_dialog_test.js

Issue 10382145: Fix for broken CertificateViewerUITest.testDetails. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Create new initializeSecondTab method. 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
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 /** 5 /**
6 * Test fixture for generated tests. 6 * Test fixture for generated tests.
7 * @extends {testing.Test} 7 * @extends {testing.Test}
8 */ 8 */
9 function CertificateViewerUITest() {}; 9 function CertificateViewerUITest() {}
10 10
11 CertificateViewerUITest.prototype = { 11 CertificateViewerUITest.prototype = {
12 __proto__: testing.Test.prototype, 12 __proto__: testing.Test.prototype,
13 13
14 /** 14 /**
15 * Define the C++ fixture class and include it. 15 * Define the C++ fixture class and include it.
16 * @type {?string} 16 * @type {?string}
17 * @override 17 * @override
18 */ 18 */
19 typedefCppFixture: 'CertificateViewerUITest', 19 typedefCppFixture: 'CertificateViewerUITest',
20 20
21 /** 21 /**
22 * Show the certificate viewer dialog. 22 * Show the certificate viewer dialog.
23 */ 23 */
24 testGenPreamble: function() { 24 testGenPreamble: function() {
25 GEN('ShowCertificateViewer();'); 25 GEN('ShowCertificateViewer();');
26 }, 26 },
27 27
28 }; 28 };
29 29
30 /** 30 /**
31 * Test fixture for asynchronous tests. 31 * Test fixture for asynchronous tests.
32 * @extends {CertificateViewerUITest} 32 * @extends {CertificateViewerUITest}
33 */ 33 */
34 function CertificateViewerUITestAsync() {}; 34 function CertificateViewerUITestAsync() {}
35 35
36 CertificateViewerUITestAsync.prototype = { 36 CertificateViewerUITestAsync.prototype = {
37 __proto__: CertificateViewerUITest.prototype, 37 __proto__: CertificateViewerUITest.prototype,
38 38
39 /** @inheritDoc */ 39 /** @inheritDoc */
40 isAsync: true, 40 isAsync: true,
41 }; 41 };
42 42
43 // Include the bulk of c++ code. 43 // Include the bulk of c++ code.
44 // Certificate viewer UI tests are disabled on platforms with native certificate 44 // Certificate viewer UI tests are disabled on platforms with native certificate
45 // viewers. 45 // viewers.
46 GEN('#include "chrome/test/data/webui/certificate_viewer_ui_test-inl.h"'); 46 GEN('#include "chrome/test/data/webui/certificate_viewer_ui_test-inl.h"');
47 GEN('') 47 GEN('');
48 48
49 // Constructors and destructors must be provided in .cc to prevent clang errors. 49 // Constructors and destructors must be provided in .cc to prevent clang errors.
50 GEN('CertificateViewerUITest::CertificateViewerUITest() {}'); 50 GEN('CertificateViewerUITest::CertificateViewerUITest() {}');
51 GEN('CertificateViewerUITest::~CertificateViewerUITest() {}'); 51 GEN('CertificateViewerUITest::~CertificateViewerUITest() {}');
52 52
53 /** 53 /**
54 * Tests that the dialog opened to the correct URL. 54 * Tests that the dialog opened to the correct URL.
55 */ 55 */
56 TEST_F('CertificateViewerUITest', 'testDialogURL', function() { 56 TEST_F('CertificateViewerUITest', 'testDialogURL', function() {
57 assertEquals(chrome.expectedUrl, window.location.href); 57 assertEquals(chrome.expectedUrl, window.location.href);
58 }); 58 });
59 59
60 /** 60 /**
61 * Tests for the correct common name in the test certificate. 61 * Tests for the correct common name in the test certificate.
62 */ 62 */
63 TEST_F('CertificateViewerUITest', 'testCN', function() { 63 TEST_F('CertificateViewerUITest', 'testCN', function() {
64 assertEquals('www.google.com', $('issued-cn').textContent); 64 assertEquals('www.google.com', $('issued-cn').textContent);
65 }); 65 });
66 66
67 /** 67 /**
68 * Test the details pane of the certificate viewer. This verifies that a 68 * Test the details pane of the certificate viewer. This verifies that a
69 * certificate in the chain can be selected to view the fields. And that fields 69 * certificate in the chain can be selected to view the fields. And that fields
70 * can be selected to view their values. 70 * can be selected to view their values.
71 * TODO(flackr,kgr): Re-enable this (http://crbug.com/127732).
72 */ 71 */
73 TEST_F('CertificateViewerUITestAsync', 'DISABLED_testDetails', function() { 72 TEST_F('CertificateViewerUITestAsync', 'testDetails', function() {
74 var certHierarchy = $('hierarchy'); 73 var certHierarchy = $('hierarchy');
75 var certFields = $('cert-fields'); 74 var certFields = $('cert-fields');
76 var certFieldVal = $('cert-field-value'); 75 var certFieldVal = $('cert-field-value');
77 76
78 // There must be at least one certificate in the hierarchy. 77 // There must be at least one certificate in the hierarchy.
79 assertLT(0, certHierarchy.childNodes.length); 78 assertLT(0, certHierarchy.childNodes.length);
80 79
81 // Select the first certificate on the chain and ensure the details show up. 80 // Select the first certificate on the chain and ensure the details show up.
82 // Override the receive certificate function to catch when fields are 81 // Override the receive certificate function to catch when fields are
83 // loaded. 82 // loaded.
83 certHierarchy.selectedItem = null;
84 cert_viewer.initializeSecondTab();
flackr 2012/05/17 15:46:56 I don't think this will work since initializeSecon
84 var getCertificateFields = cert_viewer.getCertificateFields; 85 var getCertificateFields = cert_viewer.getCertificateFields;
85 cert_viewer.getCertificateFields = this.continueTest(WhenTestDone.ALWAYS, 86 cert_viewer.getCertificateFields = this.continueTest(WhenTestDone.ALWAYS,
86 function(certFieldDetails) { 87 function(certFieldDetails) {
87 getCertificateFields(certFieldDetails); 88 getCertificateFields(certFieldDetails);
88 cert_viewer.getCertificateFields = getCertificateFields; 89 cert_viewer.getCertificateFields = getCertificateFields;
89 assertLT(0, certFields.childNodes.length); 90 assertLT(0, certFields.childNodes.length);
90 91
91 // Test that a field can be selected to see the details for that field. 92 // Test that a field can be selected to see the details for that field.
92 var item = getElementWithValue(certFields); 93 var item = getElementWithValue(certFields);
93 assertNotEquals(null, item); 94 assertNotEquals(null, item);
(...skipping 18 matching lines...) Expand all
112 function getElementWithValue(tree) { 113 function getElementWithValue(tree) {
113 for (var i = 0; i < tree.childNodes.length; i++) { 114 for (var i = 0; i < tree.childNodes.length; i++) {
114 var element = tree.childNodes[i]; 115 var element = tree.childNodes[i];
115 if (element.detail && element.detail.payload && element.detail.payload.val) 116 if (element.detail && element.detail.payload && element.detail.payload.val)
116 return element; 117 return element;
117 if (element = getElementWithValue(element)) 118 if (element = getElementWithValue(element))
118 return element; 119 return element;
119 } 120 }
120 return null; 121 return null;
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698