Bug 1144507 - Fix incorrect Promise usage in test_font_loading_api.html. r=jdaggett, a=test-only
authorCameron McCormack <cam@mcc.id.au>
Wed, 18 Mar 2015 19:54:01 +1100
changeset 250440 9fc579f7bf3a
parent 250439 e84f65c3a6aa
child 250441 46cfbcfb58c5
push id4589
push userryanvm@gmail.com
push date2015-03-19 02:20 +0000
treeherdermozilla-beta@d76c709556bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett, test-only
bugs1144507
milestone37.0
Bug 1144507 - Fix incorrect Promise usage in test_font_loading_api.html. r=jdaggett, a=test-only
layout/style/test/test_font_loading_api.html
--- a/layout/style/test/test_font_loading_api.html
+++ b/layout/style/test/test_font_loading_api.html
@@ -490,17 +490,19 @@ function runTest() {
     face.load();
     document.fonts.add(face);
 
     var newReady = document.fonts.ready;
     isnot(newReady, oldReady, "FontFaceSet.ready should be replaced when a loading FontFace is added to it (TEST 26)");
     is(document.fonts.status, "loading", "FontFaceSet.status should be set to \"loading\" when a loading FontFace is added to it (TEST 26)");
 
     return awaitEvents
-        .then(is_pending(newReady, "FontFaceSet.ready should be replaced with a fresh pending Promise when a loading FontFace is added to it", "(TEST 26)"))
+        .then(function() {
+          return is_pending(newReady, "FontFaceSet.ready should be replaced with a fresh pending Promise when a loading FontFace is added to it", "(TEST 26)");
+        })
         .then(function() {
           document.fonts.clear();
           return document.fonts.ready;
         });
 
   }).then(function() {
 
     // (TEST 27) Test that FontFaceSet.ready is resolved, .status is set to
@@ -549,17 +551,19 @@ function runTest() {
     f.load();
     document.fonts.add(f);
 
     is(document.fonts.status, "loading", "FontFaceSet.status should be \"loading\" when a loading FontFace is in it (TEST 27)");
 
     document.fonts.clear();
 
     return awaitEvents
-        .then(is_resolved_with(document.fonts.ready, document.fonts, "FontFaceSet.ready when the FontFaceSet is cleared", "(TEST 27)"))
+        .then(function() {
+          return is_resolved_with(document.fonts.ready, document.fonts, "FontFaceSet.ready when the FontFaceSet is cleared", "(TEST 27)");
+        })
         .then(function() {
           is(document.fonts.status, "loaded", "FontFaceSet.status should be set to \"loaded\" when it is cleared (TEST 27)");
           return document.fonts.ready;
         });
 
   }).then(function() {
 
     // (TEST 28) Test that FontFaceSet.ready is replaced, .status is set to
@@ -595,17 +599,19 @@ function runTest() {
     document.fonts.add(face);
     face.load();
 
     var newReady = document.fonts.ready;
     isnot(newReady, oldReady, "FontFaceSet.ready should be replaced when its only FontFace starts loading (TEST 28)");
     is(document.fonts.status, "loading", "FontFaceSet.status should be set to \"loading\" when its only FontFace starts loading (TEST 28)");
 
     return awaitEvents
-        .then(is_pending(newReady, "FontFaceSet.ready when the FontFaceSet's only FontFace starts loading", "(TEST 28)"))
+        .then(function() {
+          return is_pending(newReady, "FontFaceSet.ready when the FontFaceSet's only FontFace starts loading", "(TEST 28)");
+        })
         .then(function() {
           document.fonts.clear();
           return document.fonts.ready;
         });
 
   }).then(function() {
 
     // (TEST 29) Test that a loadingdone and a loadingerror event is dispatched
@@ -654,18 +660,18 @@ function runTest() {
     face = new FontFace("test", new ArrayBuffer(0));
 
     return face.loaded
       .then(function() {
         ok(false, "the FontFace should not load (TEST 29)");
       }, function(aError) {
         is(face.status, "error", "FontFace should have status \"error\" (TEST 29)");
         document.fonts.add(face);
+        return awaitEvents;
       })
-      .then(awaitEvents)
       .then(function() {
         document.fonts.clear();
         return document.fonts.ready;
       });
 
   }).then(function() {
 
     // (TEST 30) Test that a loadingdone event is dispatched when a FontFace
@@ -696,18 +702,18 @@ function runTest() {
     });
 
     face = new FontFace("test", fontData);
 
     return face.loaded
       .then(function() {
         is(face.status, "loaded", "FontFace should have status \"loaded\" (TEST 30)");
         document.fonts.add(face);
+        return awaitEvents;
       })
-      .then(awaitEvents)
       .then(function() {
         document.fonts.clear();
       });
 
   }).then(function() {
 
     // (TEST 31) Test that a loadingdone event is dispatched when a FontFace
     // with status "unloaded" is added to the FontFaceSet and load() is called
@@ -738,18 +744,18 @@ function runTest() {
     });
 
     face = new FontFace("test", "url(BitPattern.woff)");
 
     return face.load()
         .then(function() {
           is(face.status, "loaded", "FontFace should have status \"loaded\" (TEST 31)");
           document.fonts.add(face);
+          return awaitEvents;
         })
-        .then(awaitEvents)
         .then(function() {
           document.fonts.clear();
           return document.fonts.ready;
         });
   }).then(function() {
 
     // (TEST 32) Test that pending restyles prevent document.fonts.status
     // from becoming loaded.