Bug 1547069 - [raptor] Generalize code in waitForResult(). r=perftest-reviewers,rwood
authorHenrik Skupin <mail@hskupin.info>
Tue, 30 Apr 2019 07:58:35 +0000
changeset 530713 799e477bd09d283ad02397cb1daf154ed9379a92
parent 530699 5d8653071324fa61f37cee5d1beee64da5f82e06
child 530714 6d5bec8df2bcf4694a3f4c99b7d048dd776e300b
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersperftest-reviewers, rwood
bugs1547069
milestone68.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 1547069 - [raptor] Generalize code in waitForResult(). r=perftest-reviewers,rwood Differential Revision: https://phabricator.services.mozilla.com/D29175
testing/raptor/webext/raptor/runner.js
--- a/testing/raptor/webext/raptor/runner.js
+++ b/testing/raptor/webext/raptor/runner.js
@@ -229,62 +229,60 @@ function testTabRemoved(tab) {
 async function testTabUpdated(tab) {
   postToControlServer("status", `test tab updated: ${testTabID}`);
   // wait for pageload test result from content
   await waitForResult();
   // move on to next cycle (or test complete)
   nextCycle();
 }
 
-function waitForResult() {
-  console.log("awaiting results...");
-  return new Promise(resolve => {
-    async function checkForResult() {
+async function waitForResult() {
+  let results = await new Promise(resolve => {
+    function checkForResult() {
+      console.log("checking results...");
       switch (testType) {
         case TEST_BENCHMARK:
           if (!isBenchmarkPending) {
-            cancelTimeoutAlarm("raptor-page-timeout");
-            postToControlServer("status", "results received");
-            if (geckoProfiling) {
-              await getGeckoProfile();
-            }
             resolve();
-            if (screenCapture) {
-              await getScreenCapture();
-            }
           } else {
             setTimeout(checkForResult, 5);
           }
           break;
 
         case TEST_PAGE_LOAD:
           if (!isHeroPending &&
-            !isFNBPaintPending &&
-            !isFCPPending &&
-            !isDCFPending &&
-            !isTTFIPending &&
-            !isLoadTimePending) {
-            cancelTimeoutAlarm("raptor-page-timeout");
-            postToControlServer("status", "results received");
-            if (geckoProfiling) {
-              await getGeckoProfile();
-            }
-            if (screenCapture) {
-              await getScreenCapture();
-            }
-
+              !isFNBPaintPending &&
+              !isFCPPending &&
+              !isDCFPending &&
+              !isTTFIPending &&
+              !isLoadTimePending) {
             resolve();
           } else {
             setTimeout(checkForResult, 5);
           }
           break;
       }
     }
+
     checkForResult();
   });
+
+  cancelTimeoutAlarm("raptor-page-timeout");
+
+  postToControlServer("status", "results received");
+
+  if (geckoProfiling) {
+    await getGeckoProfile();
+  }
+
+  if (screenCapture) {
+    await getScreenCapture();
+  }
+
+  return results;
 }
 
 async function getScreenCapture() {
   console.log("Capturing screenshot...");
   var capturing;
   if (["firefox", "geckoview", "refbrow", "fenix"].includes(browserName)) {
     capturing = ext.tabs.captureVisibleTab();
     capturing.then(onCaptured, onError);