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 the POST requests display the correct information in the UI,
6 * for raw payloads with attached content-type headers.
7 */
9 function test() {
10 initNetMonitor(POST_RAW_URL).then(([aTab, aDebuggee, aMonitor]) => {
11 info("Starting test... ");
13 let { document, L10N, NetMonitorView } = aMonitor.panelWin;
14 let { RequestsMenu, NetworkDetails } = NetMonitorView;
16 RequestsMenu.lazyUpdate = false;
17 NetworkDetails._params.lazyEmpty = false;
19 waitForNetworkEvents(aMonitor, 0, 1).then(() => {
20 NetMonitorView.toggleDetailsPane({ visible: true }, 2)
21 RequestsMenu.selectedIndex = 0;
23 let TAB_UPDATED = aMonitor.panelWin.EVENTS.TAB_UPDATED;
24 waitFor(aMonitor.panelWin, TAB_UPDATED).then(() => {
25 let tab = document.querySelectorAll("#event-details-pane tab")[2];
26 let tabpanel = document.querySelectorAll("#event-details-pane tabpanel")[2];
28 is(tab.getAttribute("selected"), "true",
29 "The params tab in the network details pane should be selected.");
31 is(tabpanel.querySelector("#request-params-box")
32 .hasAttribute("hidden"), false,
33 "The request params box doesn't have the indended visibility.");
34 is(tabpanel.querySelector("#request-post-data-textarea-box")
35 .hasAttribute("hidden"), true,
36 "The request post data textarea box doesn't have the indended visibility.");
38 is(tabpanel.querySelectorAll(".variables-view-scope").length, 1,
39 "There should be 1 param scopes displayed in this tabpanel.");
40 is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 0,
41 "The empty notice should not be displayed in this tabpanel.");
43 let postScope = tabpanel.querySelectorAll(".variables-view-scope")[0];
44 is(postScope.querySelector(".name").getAttribute("value"),
45 L10N.getStr("paramsFormData"),
46 "The post scope doesn't have the correct title.");
48 is(postScope.querySelectorAll(".variables-view-variable").length, 2,
49 "There should be 2 param values displayed in the post scope.");
50 is(postScope.querySelectorAll(".variables-view-variable .name")[0].getAttribute("value"),
51 "foo", "The first query param name was incorrect.");
52 is(postScope.querySelectorAll(".variables-view-variable .value")[0].getAttribute("value"),
53 "\"bar\"", "The first query param value was incorrect.");
54 is(postScope.querySelectorAll(".variables-view-variable .name")[1].getAttribute("value"),
55 "baz", "The second query param name was incorrect.");
56 is(postScope.querySelectorAll(".variables-view-variable .value")[1].getAttribute("value"),
57 "\"123\"", "The second query param value was incorrect.");
59 teardown(aMonitor).then(finish);
60 });
61 });
63 aDebuggee.performRequests();
64 });
65 }