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
Родитель f094f51b2c
Коммит 857effa8e8
2 изменённых файлов: 35 добавлений и 2 удалений

Просмотреть файл

@ -17,7 +17,7 @@ function test() {
NetworkDetails._params.lazyEmpty = false; NetworkDetails._params.lazyEmpty = false;
Task.spawn(function () { Task.spawn(function () {
yield waitForNetworkEvents(aMonitor, 0, 6); yield waitForNetworkEvents(aMonitor, 1, 6);
EventUtils.sendMouseEvent({ type: "mousedown" }, EventUtils.sendMouseEvent({ type: "mousedown" },
document.getElementById("details-pane-toggle")); document.getElementById("details-pane-toggle"));
@ -47,6 +47,10 @@ function test() {
yield waitFor(aMonitor.panelWin, EVENTS.REQUEST_POST_PARAMS_DISPLAYED); yield waitFor(aMonitor.panelWin, EVENTS.REQUEST_POST_PARAMS_DISPLAYED);
yield testParamsTab2('a', '"b"', '?foo=bar', "text"); yield testParamsTab2('a', '"b"', '?foo=bar', "text");
RequestsMenu.selectedIndex = 6;
yield waitFor(aMonitor.panelWin, EVENTS.SIDEBAR_POPULATED);
yield testParamsTab3('a', '"b"');
yield teardown(aMonitor); yield teardown(aMonitor);
finish(); 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(); aDebuggee.performRequests();
}); });
} }

Просмотреть файл

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