Bug 1150717 - Test request with no params in the Network Monitor. r=brings

This commit is contained in:
Jan Keromnes 2015-05-06 06:49:00 +02:00
parent 57ec487eb8
commit fe10535ac6
2 changed files with 35 additions and 2 deletions

View File

@ -17,7 +17,7 @@ function test() {
NetworkDetails._params.lazyEmpty = false;
Task.spawn(function () {
yield waitForNetworkEvents(aMonitor, 0, 6);
yield waitForNetworkEvents(aMonitor, 1, 6);
EventUtils.sendMouseEvent({ type: "mousedown" },
document.getElementById("details-pane-toggle"));
@ -47,6 +47,10 @@ function test() {
yield waitFor(aMonitor.panelWin, EVENTS.REQUEST_POST_PARAMS_DISPLAYED);
yield testParamsTab2('a', '"b"', '?foo=bar', "text");
RequestsMenu.selectedIndex = 6;
yield waitFor(aMonitor.panelWin, EVENTS.SIDEBAR_POPULATED);
yield testParamsTab3('a', '"b"');
yield teardown(aMonitor);
finish();
});
@ -141,6 +145,25 @@ function test() {
});
}
function testParamsTab3(aQueryStringParamName, aQueryStringParamValue) {
let tab = document.querySelectorAll("#details-pane tab")[2];
let tabpanel = document.querySelectorAll("#details-pane tabpanel")[2];
is(tabpanel.querySelectorAll(".variables-view-scope").length, 0,
"The number of param scopes displayed in this tabpanel is incorrect.");
is(tabpanel.querySelectorAll(".variable-or-property").length, 0,
"The number of param values displayed in this tabpanel is incorrect.");
is(tabpanel.querySelectorAll(".variables-view-empty-notice").length, 1,
"The empty notice should be displayed in this tabpanel.");
is(tabpanel.querySelector("#request-params-box")
.hasAttribute("hidden"), false,
"The request params box should not be hidden.");
is(tabpanel.querySelector("#request-post-data-textarea-box")
.hasAttribute("hidden"), true,
"The request post data textarea box should be hidden.");
}
aDebuggee.performRequests();
});
}

View File

@ -15,6 +15,12 @@
<p>Request params type test</p>
<script type="text/javascript">
function get(aAddress, aQuery) {
var xhr = new XMLHttpRequest();
xhr.open("GET", aAddress + aQuery, true);
xhr.send();
}
function post(aAddress, aQuery, aContentType, aPostBody) {
var xhr = new XMLHttpRequest();
xhr.open("POST", aAddress + aQuery, true);
@ -43,7 +49,11 @@
setTimeout(function() {
post("baz", "?a=b", undefined, '?foo=bar');
// Done.
setTimeout(function() {
get("baz", "");
// Done.
}, 10);
}, 10);
}, 10);
}, 10);