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