Bug 1273795 - browser_net_service-worker-status.js: use ContentTask instead of CPOW r=ochameau a=testonly
authorJarda Snajdr <jsnajdr@gmail.com>
Fri, 12 Aug 2016 11:19:25 +0200
changeset 348065 c6f75c8af7d08a91477404ac967de6f35a0ba928
parent 348064 3343a5caa401d5df108638bf54e34538505cce55
child 348066 8c26f35e08a3ab42d442895a87ff6dd7614d0b70
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau, testonly
bugs1273795
milestone50.0a2
Bug 1273795 - browser_net_service-worker-status.js: use ContentTask instead of CPOW r=ochameau a=testonly MozReview-Commit-ID: BczmQjhjuw9
devtools/client/netmonitor/test/browser_net_service-worker-status.js
--- a/devtools/client/netmonitor/test/browser_net_service-worker-status.js
+++ b/devtools/client/netmonitor/test/browser_net_service-worker-status.js
@@ -7,18 +7,18 @@
  * Tests if requests intercepted by service workers have the correct status code
  */
 
 // Service workers only work on https
 const URL = EXAMPLE_URL.replace("http:", "https:");
 
 const TEST_URL = URL + "service-workers/status-codes.html";
 
-var test = Task.async(function* () {
-  let [, debuggee, monitor] = yield initNetMonitor(TEST_URL, null, true);
+add_task(function* () {
+  let [tab, , monitor] = yield initNetMonitor(TEST_URL, null, true);
   info("Starting test... ");
 
   let { NetMonitorView } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
 
   const REQUEST_DATA = [
     {
       method: "GET",
@@ -30,21 +30,26 @@ var test = Task.async(function* () {
         type: "plain",
         fullMimeType: "text/plain; charset=UTF-8"
       },
       stackFunctions: ["doXHR", "performRequests"]
     },
   ];
 
   info("Registering the service worker...");
-  yield debuggee.registerServiceWorker();
+  yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
+    yield content.wrappedJSObject.registerServiceWorker();
+  });
 
   info("Performing requests...");
-  debuggee.performRequests();
-  yield waitForNetworkEvents(monitor, REQUEST_DATA.length);
+  let wait = waitForNetworkEvents(monitor, REQUEST_DATA.length);
+  yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
+    content.wrappedJSObject.performRequests();
+  });
+  yield wait;
 
   let index = 0;
   for (let request of REQUEST_DATA) {
     let item = RequestsMenu.getItemAtIndex(index);
 
     info(`Verifying request #${index}`);
     yield verifyRequestItemTarget(item, request.method, request.uri, request.details);
 
@@ -59,13 +64,14 @@ var test = Task.async(function* () {
       is(stacktrace[j].functionName, functionName,
       `Request #${index} has the correct function at position #${j} on the stack`);
     });
 
     index++;
   }
 
   info("Unregistering the service worker...");
-  yield debuggee.unregisterServiceWorker();
+  yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
+    yield content.wrappedJSObject.unregisterServiceWorker();
+  });
 
   yield teardown(monitor);
-  finish();
 });