Revision 8d877aacda3215c8ef53f1bb787c7c1d1b5d2fe5 authored by Fredrik Söderquist on 07 November 2018, 09:00:38 UTC, committed by Chromium WPT Sync on 07 November 2018, 09:00:38 UTC
In css_properties.json5 we list these keywords but we didn't recognize them when parsing. Synchronize the two lists. CSS Images L3 says the following about these two values: "This property previously accepted the values optimizeSpeed and optimizeQuality. These are now deprecated; a user agent must accept them as valid values but must treat them as having the same behavior as pixelated and auto respectively, and authors must not use them." (https://drafts.csswg.org/css-images-3/#propdef-image-rendering) Bug: 901669 Change-Id: Iecc4f38e711b14fa7b6fd4beb550abdaf99d5b46
1 parent e0e8196
MediaStream-removetrack.https.html
<!doctype html>
<html>
<head>
<title>Removing a track from a MediaStream</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#widl-MediaStreamTrackList-remove-void-MediaStreamTrack-track">
<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#event-mediastream-removetrack">
</head>
<body>
<p class="instructions">When prompted, accept to share your audio stream, then your video stream.</p>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that removinging a track from a MediaStream works as expected.</p>
<video id="video" height="120" width="160" autoplay muted></video>
<audio id="audio" autoplay muted></audio>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
promise_test(async t => {
const stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
const tracks = stream.getTracks();
t.add_cleanup(() => tracks.forEach(track => track.stop()));
const stream2 = await navigator.mediaDevices.getUserMedia({audio: true});
tracks.push(...stream2.getTracks());
stream.onremovetrack = stream2.onremovetrack = t.step_func(() =>
assert_unreached("onremovetrack is not triggered by script itself"));
assert_equals(stream.getTracks().length, 2, "mediastream starts with 2 tracks");
stream.removeTrack(stream.getVideoTracks()[0]);
assert_equals(stream.getTracks().length, 1, "mediastream has 1 track left");
stream.removeTrack(stream.getAudioTracks()[0]);
assert_equals(stream.getTracks().length, 0, "mediastream has no tracks left");
stream.removeTrack(stream2.getTracks()[0]); // should not throw
// Allow time to verify no events fire.
await new Promise(r => t.step_timeout(r, 1));
}, "Tests that a removal from a MediaStream works as expected");
async function doesEventFire(t, target, name, ms = 1) {
const cookie = {};
const value = await Promise.race([
new Promise(r => target.addEventListener(name, r, {once: true})),
new Promise(r => t.step_timeout(r, ms)).then(() => cookie)
]);
return value !== cookie;
}
const doEventsFire = (t, target1, target2, name, ms = 1) => Promise.all([
doesEventFire(t, target1, "ended", ms),
doesEventFire(t, target2, "ended", ms)
]);
promise_test(async t => {
const stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
const tracks = stream.getTracks();
t.add_cleanup(() => tracks.forEach(track => track.stop()));
audio.srcObject = video.srcObject = stream;
t.add_cleanup(() => audio.srcObject = video.srcObject = null);
await Promise.all([
new Promise(r => audio.onloadedmetadata = r),
new Promise(r => video.onloadedmetadata = r)
]);
assert_equals(audio.ended, false, "audio element starts out not ended");
assert_equals(video.ended, false, "video element starts out not ended");
stream.removeTrack(stream.getVideoTracks()[0]);
{
const [audioDidEnd, videoDidEnd] = await doEventsFire(t, audio, video, "ended");
assert_equals(audio.ended, false, "audio element unaffected");
assert_equals(audioDidEnd, false, "no audio ended event should fire yet");
assert_equals(video.ended, false, "video element keeps going with audio track");
assert_equals(videoDidEnd, false, "no video ended event should fire yet");
}
stream.removeTrack(stream.getAudioTracks()[0]);
{
const [audioDidEnd, videoDidEnd] = await doEventsFire(t, audio, video, "ended");
assert_equals(audio.ended, true, "audio element ended because no more audio tracks");
assert_equals(audioDidEnd, true, "go audio ended event");
assert_equals(video.ended, true, "video element ended because no more tracks");
assert_equals(videoDidEnd, true, "got video ended event");
}
}, "Test that removal from a MediaStream fires ended on media elements (video first)");
promise_test(async t => {
const stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
const tracks = stream.getTracks();
t.add_cleanup(() => tracks.forEach(track => track.stop()));
audio.srcObject = video.srcObject = stream;
t.add_cleanup(() => audio.srcObject = video.srcObject = null);
await Promise.all([
new Promise(r => audio.onloadedmetadata = r),
new Promise(r => video.onloadedmetadata = r)
]);
assert_equals(audio.ended, false, "audio element starts out not ended");
assert_equals(video.ended, false, "video element starts out not ended");
stream.removeTrack(stream.getAudioTracks()[0]);
{
const [audioDidEnd, videoDidEnd] = await doEventsFire(t, audio, video, "ended");
assert_equals(audio.ended, true, "audio element ended because no more audio tracks");
assert_equals(audioDidEnd, true, "got audio ended event");
assert_equals(video.ended, false, "video element keeps going with video track");
assert_equals(videoDidEnd, false, "no video ended event should fire yet");
}
stream.removeTrack(stream.getVideoTracks()[0]);
{
const [audioDidEnd, videoDidEnd] = await doEventsFire(t, audio, video, "ended");
assert_equals(audio.ended, true, "audio element remains ended from before");
assert_equals(audioDidEnd, false, "no second audio ended event should fire");
assert_equals(video.ended, true, "video element ended because no more tracks");
assert_equals(videoDidEnd, true, "got video ended event");
}
}, "Test that removal from a MediaStream fires ended on media elements (audio first)");
</script>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...