Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / devtools / client / netmonitor / test / browser_net_security-details.js
blobc986c4be9f788ef3cc9451213974e283533ca328
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 /**
7 * Test that Security details tab contains the expected data.
8 */
10 add_task(async function () {
11 await pushPref("security.pki.certificate_transparency.mode", 1);
13 const { tab, monitor } = await initNetMonitor(CUSTOM_GET_URL, {
14 requestCount: 1,
15 });
16 const { document, store, windowRequire } = monitor.panelWin;
17 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
19 store.dispatch(Actions.batchEnable(false));
21 info("Performing a secure request.");
22 const REQUESTS_URL = "https://example.com" + CORS_SJS_PATH;
23 const wait = waitForNetworkEvents(monitor, 1);
24 await SpecialPowers.spawn(
25 tab.linkedBrowser,
26 [REQUESTS_URL],
27 async function (url) {
28 content.wrappedJSObject.performRequests(1, url);
31 await wait;
33 store.dispatch(Actions.toggleNetworkDetails());
34 clickOnSidebarTab(document, "security");
35 await waitUntil(() =>
36 document.querySelector("#security-panel .security-info-value")
39 const tabpanel = document.querySelector("#security-panel");
40 const textboxes = tabpanel.querySelectorAll(".security-info-value");
42 // Connection
43 // The protocol will be TLS but the exact version depends on which protocol
44 // the test server example.com supports.
45 const protocol = textboxes[0].textContent;
46 ok(protocol.startsWith('"TLS'), "The protocol " + protocol + " seems valid.");
48 // The cipher suite used by the test server example.com might change at any
49 // moment but all of them should start with "TLS_".
50 // http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
51 const suite = textboxes[1].textContent;
52 ok(suite.startsWith('"TLS_'), "The suite " + suite + " seems valid.");
54 // Host
55 is(
56 tabpanel.querySelectorAll(".treeLabel.objectLabel")[1].textContent,
57 "Host example.com:",
58 "Label has the expected value."
60 // These two values can change. So only check they're not empty.
61 Assert.notStrictEqual(
62 textboxes[2].textContent,
63 "",
64 "Label value is not empty."
66 Assert.notStrictEqual(
67 textboxes[3].textContent,
68 "",
69 "Label value is not empty."
71 is(textboxes[4].textContent, '"Disabled"', "Label has the expected value.");
72 is(textboxes[5].textContent, '"Disabled"', "Label has the expected value.");
74 // Cert
75 is(
76 textboxes[6].textContent,
77 '"example.com"',
78 "Label has the expected value."
80 is(
81 textboxes[7].textContent,
82 '"<Not Available>"',
83 "Label has the expected value."
85 is(
86 textboxes[8].textContent,
87 '"<Not Available>"',
88 "Label has the expected value."
91 is(
92 textboxes[9].textContent,
93 '"Temporary Certificate Authority"',
94 "Label has the expected value."
96 is(
97 textboxes[10].textContent,
98 '"Mozilla Testing"',
99 "Label has the expected value."
102 textboxes[11].textContent,
103 '"Profile Guided Optimization"',
104 "Label has the expected value."
107 // Locale sensitive and varies between timezones. Can't compare equality or
108 // the test fails depending on which part of the world the test is executed.
110 // cert validity begins
111 isnot(textboxes[12].textContent, "", "Label was not empty.");
112 // cert validity expires
113 isnot(textboxes[13].textContent, "", "Label was not empty.");
115 // cert sha1 fingerprint
116 isnot(textboxes[14].textContent, "", "Label was not empty.");
117 // cert sha256 fingerprint
118 isnot(textboxes[15].textContent, "", "Label was not empty.");
120 // Certificate transparency
121 isnot(textboxes[16].textContent, "", "Label was not empty.");
123 await teardown(monitor);