Bug 1180574 - Retry once if we open a window in fullscreen mode in fullscree-api-race test. r=smaug
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 21 Aug 2015 09:17:18 +1000
changeset 258790 69518fb59017ae6337103ac2686b81c1ecd41e7a
parent 258789 a5420073ea387c4c74814beca323af365b793e4c
child 258791 72ab85dd82abbace8f870bec523d7d9bff8ca7cb
push id29263
push userryanvm@gmail.com
push dateSun, 23 Aug 2015 21:18:49 +0000
treeherdermozilla-central@4ccdd06e51d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1180574
milestone43.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 1180574 - Retry once if we open a window in fullscreen mode in fullscree-api-race test. r=smaug
dom/html/test/test_fullscreen-api-race.html
--- a/dom/html/test/test_fullscreen-api-race.html
+++ b/dom/html/test/test_fullscreen-api-race.html
@@ -67,56 +67,31 @@ const ACTION_FUNCS = [
   function exitAndClose(win) {
     info("About to cancel fullscreen and close the window");
     win.document.mozCancelFullScreen();
     win.close();
     return Promise.resolve();
   }
 ];
 
-const DISABLE_LIST = [
-  // Bug 1180574
-  { openWinFunc: "openNewWindow",
-    actionFunc: "navigate",
-    platform: "Linux i686" }
-];
-
 function* testGenerator() {
   for (var openWinFunc of OPEN_WINDOW_FUNCS) {
     for (var actionFunc of ACTION_FUNCS) {
-      var skipTest = false;
-      for (var disabledItem of DISABLE_LIST) {
-        if (openWinFunc.name == disabledItem.openWinFunc &&
-            actionFunc.name == disabledItem.actionFunc &&
-            navigator.platform == disabledItem.platform) {
-          skipTest = true;
-          break;
-        }
-      }
-      if (!skipTest) {
-        info(`Testing ${openWinFunc.name}, ${actionFunc.name}`);
-        yield { openWinFunc: openWinFunc, actionFunc: actionFunc };
-      }
+      info(`Testing ${openWinFunc.name}, ${actionFunc.name}`);
+      yield { openWinFunc: openWinFunc, actionFunc: actionFunc };
     }
   }
 }
 
-var tests = testGenerator();
-
-function next() {
-  var test = tests.next().value;
-  if (!test) {
-    SimpleTest.finish();
-    return;
-  }
+function runTest(test) {
   var win = test.openWinFunc();
-  new Promise(resolve => {
+  return new Promise(resolve => {
     SimpleTest.waitForFocus(resolve, win, true);
   }).then(() => {
-    return new Promise(resolve => {
+    return new Promise((resolve, reject) => {
       var retried = false;
       function listener(evt) {
         if (!retried && evt.type == "mozfullscreenerror") {
           todo(false, "Failed to enter fullscreen, but try again");
           retried = true;
           SimpleTest.waitForFocus(() => {
             win.document.documentElement.mozRequestFullScreen();
           }, win, true);
@@ -124,22 +99,46 @@ function next() {
         }
         win.removeEventListener("mozfullscreenchange", listener);
         win.removeEventListener("mozfullscreenerror", listener);
         is(evt.type, "mozfullscreenchange", "Should get fullscreenchange");
         ok(win.document.mozFullScreen, "Should have entered fullscreen");
         ok(win.fullScreen, "The window should be in fullscreen");
         test.actionFunc(win).then(resolve);
       }
+      if (win.fullScreen) {
+        todo(false, "Should not open in fullscreen mode");
+        win.close();
+        reject();
+        return;
+      }
       info("About to enter fullscreen");
       win.addEventListener("mozfullscreenchange", listener);
       win.addEventListener("mozfullscreenerror", listener);
       win.document.documentElement.mozRequestFullScreen();
     });
   }).then(() => {
     ok(win.closed, "The window should have been closed");
-    SimpleTest.waitForFocus(next);
   });
 }
 
+var tests = testGenerator();
+
+function next() {
+  var test = tests.next().value;
+  if (test) {
+    runTest(test).catch(() => {
+      return new Promise(resolve => {
+        SimpleTest.waitForFocus(resolve);
+      }).then(() => runTest(test));
+    }).catch(() => {
+      ok(false, "Fail to run test " +
+         `${test.openWinFunc.name}, ${test.actionFunc.name}`);
+    }).then(() => SimpleTest.waitForFocus(next));
+  } else {
+    SimpleTest.finish();
+    return;
+  }
+}
+
 </script>
 </body>
 </html>