зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1760843 - P1 - add WPT for gDM frameRate:max;r=jib
Depends on D141937 Differential Revision: https://phabricator.services.mozilla.com/D142323
This commit is contained in:
Родитель
f1908f161d
Коммит
92c833260c
|
@ -7,6 +7,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<video id="display"></video>
|
||||
<script>
|
||||
'use strict';
|
||||
test(() => {
|
||||
|
@ -35,6 +36,25 @@ promise_test(t => {
|
|||
'getDisplayMedia should have returned an already-rejected promise.');
|
||||
}, `getDisplayMedia() must require user activation`);
|
||||
|
||||
promise_test( async t => {
|
||||
const v = document.getElementById('display');
|
||||
v.autoplay = true;
|
||||
// work around firefox bug 1586505, orthogonal to what's being tested
|
||||
const frames = () => v.getVideoPlaybackQuality()?.totalVideoFrames || v.mozPaintedFrames;
|
||||
const target_rate = 5;
|
||||
const stream = await getDisplayMedia({video: {width:160, frameRate: target_rate}});
|
||||
t.add_cleanup(() => stopTracks(stream));
|
||||
v.srcObject = stream;
|
||||
const intitial_time = v.currentTime;
|
||||
const initial_frame_count = frames();
|
||||
await new Promise(r => t.step_timeout(r, 10000));
|
||||
const total_elapsed_frames = frames() - initial_frame_count;
|
||||
const total_elapsed_time = v.currentTime - intitial_time;
|
||||
const average_fps = total_elapsed_frames / total_elapsed_time;
|
||||
assert_greater_than_equal(average_fps, target_rate * 0.50);
|
||||
assert_less_than_equal(average_fps, target_rate * 1.75);
|
||||
}, "getDisplayMedia() must adhere to frameRate if set");
|
||||
|
||||
[
|
||||
{video: true},
|
||||
{video: true, audio: false},
|
||||
|
|
Загрузка…
Ссылка в новой задаче