summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_VideoPlaybackQuality.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_VideoPlaybackQuality.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_VideoPlaybackQuality.html')
-rw-r--r--dom/media/test/test_VideoPlaybackQuality.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/dom/media/test/test_VideoPlaybackQuality.html b/dom/media/test/test_VideoPlaybackQuality.html
new file mode 100644
index 000000000..be051c0a6
--- /dev/null
+++ b/dom/media/test/test_VideoPlaybackQuality.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test basic functionality of VideoPlaybackQuality</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function test() {
+ var video = document.createElement("video");
+ ok(video.getVideoPlaybackQuality, "getVideoPlaybackQuality should be exposed with pref set");
+
+ var vpq = video.getVideoPlaybackQuality();
+ ok(vpq, "getVideoPlaybackQuality should return an object");
+ ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
+ is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
+ is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
+ is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
+
+ var vpq2 = video.getVideoPlaybackQuality();
+ ok(vpq !== vpq2, "getVideoPlaybackQuality should return a new object");
+ ok(vpq.creationTime <= vpq2.creationTime, "VideoPlaybackQuality objects should have increasing creationTime");
+
+ var audio = document.createElement("audio");
+ ok(!audio.getVideoPlaybackQuality, "getVideoPlaybackQuality should not be available on Audio elements");
+
+ video.src = "seek.webm";
+ video.play();
+ video.addEventListener("ended", function () {
+ vpq = video.getVideoPlaybackQuality();
+ ok(vpq.creationTime <= performance.now(), "creationTime should be in the past");
+ ok(vpq.totalVideoFrames > 0, "totalVideoFrames should be > 0");
+ ok(vpq.droppedVideoFrames >= 0, "droppedVideoFrames should be >= 0");
+ ok(vpq.droppedVideoFrames <= vpq.totalVideoFrames, "droppedVideoFrames should be <= totalVideoFrames");
+ ok(vpq.corruptedVideoFrames >= 0, "corruptedVideoFrames should be >= 0");
+
+ SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, function () {
+ vpq = video.getVideoPlaybackQuality();
+ is(vpq.creationTime, 0, "creationTime should be 0");
+ is(vpq.totalVideoFrames, 0, "totalVideoFrames should be 0");
+ is(vpq.droppedVideoFrames, 0, "droppedVideoFrames should be 0");
+ is(vpq.corruptedVideoFrames, 0, "corruptedVideoFrames should be 0");
+
+ SimpleTest.finish();
+ });
+ });
+}
+
+addLoadEvent(function() {
+ SpecialPowers.pushPrefEnv({"set":
+ [
+ ["media.mediasource.enabled", true],
+ ]
+ }, test);
+});
+</script>
+</pre>
+</body>
+</html>