mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1474051 [wpt PR 11834] - Update the media-source IDL file, a=testonly
Automatic update from web-platform-testsAdd the media-source IDL file + update test (#11834) -- wpt-commits: 36711c4fbafa1d61edb0fca0669422ffcae3a0ce wpt-pr: 11834
This commit is contained in:
parent
867dcc77bc
commit
4a4087e3e6
@ -288028,6 +288028,11 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"interfaces/media-source.idl": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"interfaces/mediacapture-depth.idl": [
|
||||
[
|
||||
{}
|
||||
@ -353818,9 +353823,13 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"media-source/interfaces.html": [
|
||||
"media-source/idlharness.any.js": [
|
||||
[
|
||||
"/media-source/interfaces.html",
|
||||
"/media-source/idlharness.any.html",
|
||||
{}
|
||||
],
|
||||
[
|
||||
"/media-source/idlharness.any.worker.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
@ -592677,6 +592686,10 @@
|
||||
"dad6123e39feca39ec620de51307e56823cc5408",
|
||||
"support"
|
||||
],
|
||||
"interfaces/media-source.idl": [
|
||||
"a3c8e49db54b906ae99e2aa2cc385c0e4d949a80",
|
||||
"support"
|
||||
],
|
||||
"interfaces/mediacapture-depth.idl": [
|
||||
"2ac0dcf83f5afb227f24c9063d738dd22e941fe9",
|
||||
"support"
|
||||
@ -593821,14 +593834,14 @@
|
||||
"fefa39b93290d8d97b18f606c5166d7792193251",
|
||||
"support"
|
||||
],
|
||||
"media-source/idlharness.any.js": [
|
||||
"d9b97ca6d0883ef11491723a5db5b9e92e32a380",
|
||||
"testharness"
|
||||
],
|
||||
"media-source/import_tests.sh": [
|
||||
"943d26f264d59f2a7c01db30f5d91e72dafa9935",
|
||||
"support"
|
||||
],
|
||||
"media-source/interfaces.html": [
|
||||
"f836da38e12662cd56590d5a0534ad555dbf249e",
|
||||
"testharness"
|
||||
],
|
||||
"media-source/manifest.txt": [
|
||||
"d1e89d132c19294d2c7bb677668c03f3309b475e",
|
||||
"support"
|
||||
|
@ -1,30 +1,17 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Media Source Extensions IDL tests</title>
|
||||
<div id=log></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/WebIDLParser.js></script>
|
||||
<script src=/resources/idlharness.js></script>
|
||||
<script type=text/plain class=untested>
|
||||
interface EventTarget {
|
||||
void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
|
||||
void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
|
||||
boolean dispatchEvent(Event event);
|
||||
// GENERATED CONTENT - DO NOT EDIT
|
||||
// Content of this file was automatically extracted from the
|
||||
// "Media Source Extensions™" spec.
|
||||
// See: https://w3c.github.io/media-source/
|
||||
|
||||
enum ReadyState {
|
||||
"closed",
|
||||
"open",
|
||||
"ended"
|
||||
};
|
||||
enum EndOfStreamError {
|
||||
"network",
|
||||
"decode"
|
||||
};
|
||||
interface EventHandler {};
|
||||
interface URL {};
|
||||
interface HTMLVideoElement {};
|
||||
interface AudioTrack {};
|
||||
interface AudioTrackList {};
|
||||
interface VideoTrack {};
|
||||
interface VideoTrackList {};
|
||||
interface TextTrack {};
|
||||
interface TextTrackList {};
|
||||
interface TimeRanges {};
|
||||
typedef double DOMHighResTimeStamp;
|
||||
</script>
|
||||
<script type=text/plain>
|
||||
[Constructor]
|
||||
interface MediaSource : EventTarget {
|
||||
readonly attribute SourceBufferList sourceBuffers;
|
||||
@ -41,7 +28,10 @@ interface MediaSource : EventTarget {
|
||||
void clearLiveSeekableRange();
|
||||
static boolean isTypeSupported(DOMString type);
|
||||
};
|
||||
|
||||
enum AppendMode {
|
||||
"segments",
|
||||
"sequence"
|
||||
};
|
||||
interface SourceBuffer : EventTarget {
|
||||
attribute AppendMode mode;
|
||||
readonly attribute boolean updating;
|
||||
@ -59,86 +49,24 @@ interface SourceBuffer : EventTarget {
|
||||
attribute EventHandler onabort;
|
||||
void appendBuffer(BufferSource data);
|
||||
void abort();
|
||||
void changeType(DOMString type);
|
||||
void remove(double start, unrestricted double end);
|
||||
};
|
||||
|
||||
interface SourceBufferList : EventTarget {
|
||||
readonly attribute unsigned long length;
|
||||
attribute EventHandler onaddsourcebuffer;
|
||||
attribute EventHandler onremovesourcebuffer;
|
||||
getter SourceBuffer (unsigned long index);
|
||||
};
|
||||
|
||||
[Exposed=Window,DedicatedWorker,SharedWorker]
|
||||
[Exposed=Window]
|
||||
partial interface URL {
|
||||
static DOMString createObjectURL(MediaSource mediaSource);
|
||||
};
|
||||
|
||||
partial interface AudioTrack {
|
||||
readonly attribute SourceBuffer? sourceBuffer;
|
||||
};
|
||||
|
||||
partial interface VideoTrack {
|
||||
readonly attribute SourceBuffer? sourceBuffer;
|
||||
};
|
||||
|
||||
partial interface TextTrack {
|
||||
readonly attribute SourceBuffer? sourceBuffer;
|
||||
};
|
||||
|
||||
enum EndOfStreamError {
|
||||
"network",
|
||||
"decode"
|
||||
};
|
||||
|
||||
enum AppendMode {
|
||||
"segments",
|
||||
"sequence"
|
||||
};
|
||||
|
||||
enum ReadyState {
|
||||
"closed",
|
||||
"open",
|
||||
"ended"
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
"use strict";
|
||||
setup({ explicit_done: true });
|
||||
var mediaSource;
|
||||
var sourceBuffer;
|
||||
var video = document.createElement("video");
|
||||
var idlCheck = function() {
|
||||
var idlArray = new IdlArray();
|
||||
[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
|
||||
if (node.className == "untested") {
|
||||
idlArray.add_untested_idls(node.textContent);
|
||||
} else {
|
||||
idlArray.add_idls(node.textContent);
|
||||
}
|
||||
});
|
||||
idlArray.add_objects({
|
||||
MediaSource: ['mediaSource'],
|
||||
SourceBuffer: ['sourceBuffer'],
|
||||
SourceBufferList: ['mediaSource.sourceBuffers']
|
||||
});
|
||||
idlArray.test();
|
||||
done();
|
||||
}
|
||||
mediaSource = new MediaSource();
|
||||
video.src = URL.createObjectURL(mediaSource);
|
||||
mediaSource.addEventListener("sourceopen", function () {
|
||||
var defaultType ='video/webm;codecs="vp8,vorbis"';
|
||||
if (MediaSource.isTypeSupported(defaultType)) {
|
||||
sourceBuffer = mediaSource.addSourceBuffer(defaultType);
|
||||
} else {
|
||||
sourceBuffer = mediaSource.addSourceBuffer('video/mp4');
|
||||
}
|
||||
sourceBuffer.addEventListener("updateend", function (e) {
|
||||
mediaSource.endOfStream();
|
||||
idlCheck();
|
||||
});
|
||||
sourceBuffer.appendBuffer(new ArrayBuffer());
|
||||
});
|
||||
</script>
|
59
testing/web-platform/tests/media-source/idlharness.any.js
Normal file
59
testing/web-platform/tests/media-source/idlharness.any.js
Normal file
@ -0,0 +1,59 @@
|
||||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/media-source/
|
||||
|
||||
'use strict';
|
||||
|
||||
var mediaSource;
|
||||
var sourceBuffer;
|
||||
var video = document.createElement("video");
|
||||
|
||||
promise_test(async t => {
|
||||
const srcs = ['media-source', 'dom', 'html', 'url'];
|
||||
const [idl, dom, html, url] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
var idlArray = new IdlArray();
|
||||
idlArray.add_idls(idl);
|
||||
idlArray.add_dependency_idls(dom);
|
||||
idlArray.add_dependency_idls(html);
|
||||
idlArray.add_dependency_idls(url);
|
||||
|
||||
const testIdls = new Promise(resolve => {
|
||||
try {
|
||||
mediaSource = new MediaSource();
|
||||
video.src = URL.createObjectURL(mediaSource);
|
||||
mediaSource.addEventListener("sourceopen", function () {
|
||||
var defaultType ='video/webm;codecs="vp8,vorbis"';
|
||||
if (MediaSource.isTypeSupported(defaultType)) {
|
||||
sourceBuffer = mediaSource.addSourceBuffer(defaultType);
|
||||
} else {
|
||||
sourceBuffer = mediaSource.addSourceBuffer('video/mp4');
|
||||
}
|
||||
sourceBuffer.addEventListener("updateend", function (e) {
|
||||
mediaSource.endOfStream();
|
||||
resolve();
|
||||
});
|
||||
sourceBuffer.appendBuffer(new ArrayBuffer());
|
||||
});
|
||||
} catch (e) {
|
||||
// Will be surfaced in idlharness.js's test_object below.
|
||||
}
|
||||
})
|
||||
|
||||
idlArray.add_objects({
|
||||
MediaSource: ['mediaSource'],
|
||||
SourceBuffer: ['sourceBuffer'],
|
||||
SourceBufferList: ['mediaSource.sourceBuffers']
|
||||
});
|
||||
|
||||
const timeout = new Promise((_, reject) => t.step_timeout(reject, 3000));
|
||||
return Promise
|
||||
.race([testIdls, timeout])
|
||||
.then(() => { idlArray.test(); })
|
||||
.catch(() => {
|
||||
idlArray.test();
|
||||
return Promise.reject('Failed to create media-source objects')
|
||||
});
|
||||
}, 'media-source interfaces');
|
Loading…
Reference in New Issue
Block a user