Bug 1550633 - part14 : add a test for 'honor user preferences for automatic text track selection'. r=bzbarsky
☠☠ backed out by 6acae89335b0 ☠ ☠
authoralwu <alwu@mozilla.com>
Thu, 23 May 2019 09:03:10 +0000
changeset 475269 583d4e0945ad964ef5a9cc1a8ccec8faa248e32b
parent 475268 29487a59512dd951a532f1be441d29c6c618c1d8
child 475270 bbd8f62b9bff25922b19925a83cf287be4b2dc1d
push id36058
push useraciure@mozilla.com
push dateFri, 24 May 2019 03:53:25 +0000
treeherdermozilla-central@c87317c41902 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1550633
milestone69.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 1550633 - part14 : add a test for 'honor user preferences for automatic text track selection'. r=bzbarsky This test is used to ensure that we queue 'honor user preferences for automatic text track selection' as a marco task, not a mirco task. In this test, we would trigger a media event before queuing a text track selection task, and check the text track's mode to know whether the text track selection runs after the task for media event. Differential Revision: https://phabricator.services.mozilla.com/D31921
testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-selection-task-order.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-selection-task-order.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>HTMLTrackElement Text Track Selection Task Order</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+/**
+ * This test is used to ensure that we queue 'honor user preferences for automatic
+ * text track selection' as a macro task, not a micro task. In this test, we
+ * trigger a media event before queuing a text track selection task, and check
+ * the text track's mode to know whether the text track selection runs after the
+ * task for media event.
+ */
+async_test(function(t) {
+    let video = document.createElement("video");
+    video.play();
+    video.onplay = t.step_func(startedPlay);
+
+    // When we create a text track element, it queue a task to run automatic
+    // text track selection later.
+    let track = document.createElement("track");
+    track.default = true;
+    video.appendChild(track);
+    assert_equals(track.track.mode, "disabled", "Text track's mode is disabled by default.");
+
+    function startedPlay() {
+        assert_equals(track.track.mode, "disabled", "Text track selection hasn't started yet.");
+        track.onerror = t.step_func_done(trackError);
+    }
+
+    function trackError() {
+        assert_equals(track.track.mode, "showing", "Text track selection modified track's mode.");
+        t.done();
+    }
+});
+
+</script>