Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests if html responses show and properly populate a "Preview" tab.
6 */
8 function test() {
9 initNetMonitor(CONTENT_TYPE_URL).then(([aTab, aDebuggee, aMonitor]) => {
10 info("Starting test... ");
12 let { $, document, EVENTS, NetMonitorView } = aMonitor.panelWin;
13 let { RequestsMenu } = NetMonitorView;
15 RequestsMenu.lazyUpdate = false;
17 waitForNetworkEvents(aMonitor, 6).then(() => {
18 EventUtils.sendMouseEvent({ type: "mousedown" },
19 document.getElementById("details-pane-toggle"));
21 is($("#event-details-pane").selectedIndex, 0,
22 "The first tab in the details pane should be selected.");
23 is($("#preview-tab").hidden, true,
24 "The preview tab should be hidden for non html responses.");
25 is($("#preview-tabpanel").hidden, true,
26 "The preview tabpanel should be hidden for non html responses.");
28 RequestsMenu.selectedIndex = 4;
29 NetMonitorView.toggleDetailsPane({ visible: true, animated: false }, 5);
31 is($("#event-details-pane").selectedIndex, 5,
32 "The fifth tab in the details pane should be selected.");
33 is($("#preview-tab").hidden, false,
34 "The preview tab should be visible now.");
35 is($("#preview-tabpanel").hidden, false,
36 "The preview tabpanel should be visible now.");
38 waitFor(aMonitor.panelWin, EVENTS.RESPONSE_HTML_PREVIEW_DISPLAYED).then(() => {
39 let iframe = $("#response-preview");
40 ok(iframe,
41 "There should be a response preview iframe available.");
42 ok(iframe.contentDocument,
43 "The iframe's content document should be available.");
44 is(iframe.contentDocument.querySelector("blink").textContent, "Not Found",
45 "The iframe's content document should be loaded and correct.");
47 RequestsMenu.selectedIndex = 5;
49 is($("#event-details-pane").selectedIndex, 0,
50 "The first tab in the details pane should be selected again.");
51 is($("#preview-tab").hidden, true,
52 "The preview tab should be hidden again for non html responses.");
53 is($("#preview-tabpanel").hidden, true,
54 "The preview tabpanel should be hidden again for non html responses.");
56 teardown(aMonitor).then(finish);
57 });
58 });
60 aDebuggee.performRequests();
61 });
62 }