Bug 1383512 - Add waiting code until loading FontSet and finishing styling to test_user_select.html. r=birtles
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 25 Aug 2017 15:37:53 +0900
changeset 426342 5e88f7a90eea0806c10af446b57fef2a0982b729
parent 426341 4d4296e650423faa07ef7ed55cbac7ab5a1c6f05
child 426343 481f9c999735955352525516e2b4c21a33198636
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1383512
milestone57.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 1383512 - Add waiting code until loading FontSet and finishing styling to test_user_select.html. r=birtles In some environment, test will start before applying font face. To ensure that content apply font, this patch changes to wait for starting test until loading FontSet and finishing styling. MozReview-Commit-ID: GakUcOgRQE8
dom/base/test/mochitest.ini
dom/base/test/test_user_select.html
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -780,17 +780,17 @@ skip-if = debug == false
 [test_textnode_split_in_selection.html]
 [test_timeout_clamp.html]
 skip-if = debug == true && toolkit == 'android' # Timing dependent, skip slow debug android builds
 [test_timer_flood.html]
 [test_title.html]
 support-files = file_title.xul
 [test_treewalker_nextsibling.xml]
 [test_user_select.html]
-skip-if = (toolkit == 'android') || (os == 'win' && !debug) # Windows is timing dependent(bug 1383512)
+skip-if = toolkit == 'android'
 [test_viewport_scroll.html]
 [test_viewsource_forbidden_in_object.html]
 [test_w3element_traversal.html]
 [test_w3element_traversal.xhtml]
 [test_w3element_traversal_svg.html]
 [test_warning_for_blocked_cross_site_request.html]
 [test_webaudioNotification.html]
 tags = audiochannel
--- a/dom/base/test/test_user_select.html
+++ b/dom/base/test/test_user_select.html
@@ -328,14 +328,22 @@ function test()
   is(sel.rangeCount, 2, "testD: kbd selection is filtered");
   is(sel.getRangeAt(0).toString(), 'aaaa', "testD: kbd selection is filtered");
   is(sel.getRangeAt(1).toString(), 'cccc', "testD: kbd selection is filtered");
   doneTest(e);
 
   clear();
   SimpleTest.finish();
 }
-window.onload = function() { setTimeout(test, 0); };
+
+// These tests depends on the Ahem font being loaded and rendered so wait for
+// font to load, then wait a frame for them to be rendered too.
+window.onload = function() {
+  document.fonts.ready.then(function() {
+    requestAnimationFrame(test);
+  });
+};
+
 SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>