Bug 1150717 - Test request with no params in the Network Monitor. r=brings
authorJan Keromnes <janx@linux.com>
Wed, 06 May 2015 06:49:00 +0200
changeset 274080 47643a12ed87b86fced4d3f8c4ebffffe873485e
parent 274027 019c10ffbe1607f2618d216b86b028d41bceea74
child 274081 ecf299ff9d4b84bb3301e2e271b0b60fe44554e7
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbrings
bugs1150717
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1150717 - Test request with no params in the Network Monitor. r=brings
browser/devtools/netmonitor/test/browser_net_complex-params.js
browser/devtools/netmonitor/test/html_params-test-page.html
--- a/browser/devtools/netmonitor/test/browser_net_complex-params.js
+++ b/browser/devtools/netmonitor/test/browser_net_complex-params.js
@@ -12,17 +12,17 @@ function test() {
 
     let { document, L10N, EVENTS, Editor, NetMonitorView } = aMonitor.panelWin;
     let { RequestsMenu, NetworkDetails } = NetMonitorView;
 
     RequestsMenu.lazyUpdate = false;
     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"));
       EventUtils.sendMouseEvent({ type: "mousedown" },
         document.querySelectorAll("#details-pane tab")[2]);
 
       yield waitFor(aMonitor.panelWin, EVENTS.REQUEST_POST_PARAMS_DISPLAYED);
       yield testParamsTab1('a', '""', '{ "foo": "bar" }', '""');
@@ -42,16 +42,20 @@ function test() {
       RequestsMenu.selectedIndex = 4;
       yield waitFor(aMonitor.panelWin, EVENTS.REQUEST_POST_PARAMS_DISPLAYED);
       yield testParamsTab2('a', '"b"', '{ "foo": "bar" }', "js");
 
       RequestsMenu.selectedIndex = 5;
       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();
     });
 
     function testParamsTab1(
       aQueryStringParamName, aQueryStringParamValue, aFormDataParamName, aFormDataParamValue)
     {
       let tab = document.querySelectorAll("#details-pane tab")[2];
@@ -136,11 +140,30 @@ function test() {
       return NetMonitorView.editor("#request-post-data-textarea").then((aEditor) => {
         is(aEditor.getText(), aRequestPayload,
           "The text shown in the source editor is incorrect.");
         is(aEditor.getMode(), Editor.modes[aEditorMode],
           "The mode active in the source editor is incorrect.");
       });
     }
 
+    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();
   });
 }
--- a/browser/devtools/netmonitor/test/html_params-test-page.html
+++ b/browser/devtools/netmonitor/test/html_params-test-page.html
@@ -10,16 +10,22 @@
     <meta http-equiv="Expires" content="0" />
     <title>Network Monitor test page</title>
   </head>
 
   <body>
     <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);
         xhr.setRequestHeader("content-type", aContentType);
         xhr.send(aPostBody);
       }
 
       function performRequests() {
@@ -38,17 +44,21 @@
                 post("baz", "?a", undefined, '{ "foo": "bar" }');
 
                 setTimeout(function() {
                   post("baz", "?a=b", undefined, '{ "foo": "bar" }');
 
                   setTimeout(function() {
                     post("baz", "?a=b", undefined, '?foo=bar');
 
-                    // Done.
+                    setTimeout(function() {
+                      get("baz", "");
+
+                      // Done.
+                    }, 10);
                   }, 10);
                 }, 10);
               }, 10);
             }, 10);
           }, 10);
         }, 10);
       }
     </script>