summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_preserve_playbackrate_after_ui_play.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/media/test/test_preserve_playbackrate_after_ui_play.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_preserve_playbackrate_after_ui_play.html')
-rw-r--r--dom/media/test/test_preserve_playbackrate_after_ui_play.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/dom/media/test/test_preserve_playbackrate_after_ui_play.html b/dom/media/test/test_preserve_playbackrate_after_ui_play.html
new file mode 100644
index 000000000..628d5c0c7
--- /dev/null
+++ b/dom/media/test/test_preserve_playbackrate_after_ui_play.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title> Bug 1013933 - preserve playbackRate after clicking play button </title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="browserElementTestHelpers.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<div id="content">
+ <video width="320" height="240" id="video" controls mozNoDynamicControls preload="auto"></video>
+</div>
+
+<script type="text/javascript">
+/*
+ * Positions of the UI elements, relative to the upper-left corner of the
+ * <video> box.
+ */
+const videoHeight = 240;
+const playButtonWidth = 28;
+const playButtonHeight = 28;
+const playButtonCenterX = 0 + Math.round(playButtonWidth / 2);
+const playButtonCenterY = videoHeight - Math.round(playButtonHeight / 2);
+
+var expectedPlaybackRate = 0.5
+
+function runTest() {
+ var video = document.getElementById("video");
+ video.src = "audio.wav";
+ video.loop = true;
+ video.playbackRate = expectedPlaybackRate;
+
+ video.oncanplaythrough = function() {
+ video.oncanplaythrough = null;
+ is(video.paused, true, "video is not playing yet.");
+ is(video.playbackRate, expectedPlaybackRate,
+ "playbackRate is correct before clicking play button.");
+
+ // Click the play button
+ synthesizeMouse(video, playButtonCenterX, playButtonCenterY, { });
+ };
+
+ video.onplay = function() {
+ video.onplay = null;
+ is(video.paused, false, "video starts playing.");
+ is(video.playbackRate, expectedPlaybackRate,
+ "playbackRate is correct after clicking play button.");
+ video.pause();
+ SimpleTest.finish();
+ };
+}
+
+window.addEventListener("load", runTest, false);
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+</body>
+</html>