blob: 333bd0d41c5dc54317a00811a4f9a7056e762313 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/**
* This test is used to ensure we suspend video decoding if video is not in the
* viewport.
*/
"use strict";
const PAGE =
"https://example.com/browser/toolkit/content/tests/browser/file_outside_viewport_videos.html";
async function test_suspend_video_decoding() {
let videos = content.document.getElementsByTagName("video");
for (let video of videos) {
info(`- start video on the ${video.id} side and outside the viewport -`);
await video.play();
ok(true, `video started playing`);
ok(video.isVideoDecodingSuspended, `video decoding is suspended`);
}
}
add_task(async function setup_test_preference() {
await SpecialPowers.pushPrefEnv({
set: [
["media.suspend-bkgnd-video.enabled", true],
["media.suspend-bkgnd-video.delay-ms", 0],
],
});
});
add_task(async function start_test() {
await BrowserTestUtils.withNewTab(
{
gBrowser,
url: PAGE,
},
async browser => {
await SpecialPowers.spawn(browser, [], test_suspend_video_decoding);
}
);
});
|