Bug 1332949 - test case for copy binary data. r?honza draft
authorLocke Chen <locke12456@gmail.com>
Wed, 24 May 2017 13:39:37 +0800
changeset 583508 9aaac1659f12ee291b7b46aeb3a63c94734af705
parent 583507 f3335cfeb177849a711a148bca3878666352b4f7
child 630079 e5262d357915fb91b051ee21030f975ccb98b9c7
push id60416
push userbmo:locke12456@gmail.com
push dateWed, 24 May 2017 05:40:21 +0000
reviewershonza
bugs1332949
milestone55.0a1
Bug 1332949 - test case for copy binary data. r?honza MozReview-Commit-ID: DSDSkdjjwHC
devtools/client/framework/test/shared-head.js
devtools/client/netmonitor/test/browser_net_copy_params.js
devtools/client/netmonitor/test/html_params-test-page.html
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -513,17 +513,17 @@ function synthesizeContextMenuEvent(el) 
   EventUtils.synthesizeMouse(el, 5, 2, eventDetails, el.ownerDocument.defaultView);
 }
 
 /**
  * Promise wrapper around SimpleTest.waitForClipboard
  */
 function waitForClipboardPromise(setup, expected) {
   return new Promise((resolve, reject) => {
-    SimpleTest.waitForClipboard(expected, setup, resolve, reject);
+    SimpleTest.waitForClipboard(expected, setup, resolve, reject,null,3000);
   });
 }
 
 /**
  * Simple helper to push a temporary preference. Wrapper on SpecialPowers
  * pushPrefEnv that returns a promise resolving when the preferences have been
  * updated.
  *
--- a/devtools/client/netmonitor/test/browser_net_copy_params.js
+++ b/devtools/client/netmonitor/test/browser_net_copy_params.js
@@ -11,17 +11,17 @@ add_task(function* () {
   let { tab, monitor } = yield initNetMonitor(PARAMS_URL);
   info("Starting test... ");
 
   let { document, store, windowRequire } = monitor.panelWin;
   let Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
 
   store.dispatch(Actions.batchEnable(false));
 
-  let wait = waitForNetworkEvents(monitor, 1, 6);
+  let wait = waitForNetworkEvents(monitor, 1, 7);
   yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
     content.wrappedJSObject.performRequests();
   });
   yield wait;
 
   yield testCopyUrlParamsHidden(0, false);
   yield testCopyUrlParams(0, "a");
   yield testCopyPostDataHidden(0, false);
@@ -47,18 +47,24 @@ add_task(function* () {
   yield testCopyPostDataHidden(4, false);
   yield testCopyPostData(4, "{ \"foo\": \"bar\" }");
 
   yield testCopyUrlParamsHidden(5, false);
   yield testCopyUrlParams(5, "a=b");
   yield testCopyPostDataHidden(5, false);
   yield testCopyPostData(5, "?foo=bar");
 
-  yield testCopyUrlParamsHidden(6, true);
-  yield testCopyPostDataHidden(6, true);
+  yield testCopyUrlParamsHidden(6, false);
+  yield testCopyUrlParams(6, "a=b");
+  yield testCopyPostDataHidden(6, false);
+  yield testCopyPostData(6,
+    "Ãi\u0012®4Ýð?ð\u0007ó ^|áŽoè¯M‹IB‹\u0002tŒö\u001b–¹ÿ\u000e*õ\u0001");
+
+  yield testCopyUrlParamsHidden(7, true);
+  yield testCopyPostDataHidden(7, true);
 
   return teardown(monitor);
 
   function testCopyUrlParamsHidden(index, hidden) {
     EventUtils.sendMouseEvent({ type: "mousedown" },
       document.querySelectorAll(".request-list-item")[index]);
     EventUtils.sendMouseEvent({ type: "contextmenu" },
       document.querySelectorAll(".request-list-item")[index]);
--- a/devtools/client/netmonitor/test/html_params-test-page.html
+++ b/devtools/client/netmonitor/test/html_params-test-page.html
@@ -49,19 +49,22 @@
 
                 setTimeout(function () {
                   post("baz", "?a=b", undefined, '{ "foo": "bar" }');
 
                   setTimeout(function () {
                     post("baz", "?a=b", undefined, "?foo=bar");
 
                     setTimeout(function () {
-                      get("baz", "");
+                      post("baz", "?a=b", undefined, "Ãi®4Ýð?ðó ^|áŽoè¯M‹IB‹tŒö–¹ÿ*õ");
+                      setTimeout(function () {
+                        get("baz", "");
 
-                      // Done.
+                        // Done.
+                      }, 10);
                     }, 10);
                   }, 10);
                 }, 10);
               }, 10);
             }, 10);
           }, 10);
         }, 10);
         /* eslint-enable max-nested-callbacks */