Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (236366 => 236367)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-09-21 22:56:55 UTC (rev 236366)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-09-21 23:06:40 UTC (rev 236367)
@@ -1,3 +1,18 @@
+2018-09-21 YUHAN WU <[email protected]>
+
+ Import WPT content hint tests
+ https://bugs.webkit.org/show_bug.cgi?id=189854
+
+ Reviewed by Youenn Fablet.
+
+ * resources/import-expectations.json:
+ * web-platform-tests/mst-content-hint/META.yml: Added.
+ * web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint-expected.txt: Added.
+ * web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html: Added.
+ * web-platform-tests/mst-content-hint/idlharness.window.html: Added.
+ * web-platform-tests/mst-content-hint/idlharness.window.js: Added.
+ * web-platform-tests/mst-content-hint/w3c-import.log: Added.
+
2018-09-21 Youenn Fablet <[email protected]>
Add RTCCodecStats support
Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (236366 => 236367)
--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-09-21 22:56:55 UTC (rev 236366)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json 2018-09-21 23:06:40 UTC (rev 236367)
@@ -262,6 +262,7 @@
"web-platform-tests/mediasession": "skip",
"web-platform-tests/microdata": "skip",
"web-platform-tests/mixed-content": "skip",
+ "web-platform-tests/mst-content-hint": "import",
"web-platform-tests/navigation-timing": "skip",
"web-platform-tests/netinfo": "skip",
"web-platform-tests/notifications": "import",
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/META.yml (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/META.yml (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/META.yml 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1,3 @@
+spec: https://w3c.github.io/mst-content-hint/
+suggested_reviewers:
+ - alvestrand
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint-expected.txt (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint-expected.txt 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1,9 @@
+
+FAIL Tracks have empty default content hint assert_equals: expected (undefined) undefined but got (string) ""
+PASS Accepts valid audio contentHints
+FAIL Audio tracks ignore invalid/video contentHints assert_equals: Audio tracks should ignore video-only contentHints. expected "speech" but got "motion"
+PASS Accepts valid video contentHints
+FAIL Video tracks ignore invalid/audio contentHints assert_equals: Video tracks should ignore audio-only contentHints. expected "motion" but got "speech"
+FAIL Cloned video tracks have separate contentHints assert_equals: expected (string) "motion" but got (undefined) undefined
+FAIL Cloned audio tracks have separate contentHints assert_equals: expected (string) "speech" but got (undefined) undefined
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<script src=""
+<script src=""
+<canvas id="canvas">
+</canvas>
+<script>
+
+function createAudioTrack() {
+ ac = new AudioContext();
+ var osc = ac.createOscillator();
+ var dest = ac.createMediaStreamDestination();
+ osc.connect(dest);
+ audio_track = dest.stream.getAudioTracks()[0];
+
+ assert_equals(audio_track.kind, "audio");
+ return audio_track;
+}
+
+function createVideoTrack() {
+ canvas = document.getElementById("canvas");
+ video_track = canvas.captureStream().getVideoTracks()[0];
+
+ assert_equals(video_track.kind, "video");
+ return video_track;
+}
+
+test(t => {
+ audio_track = createAudioTrack();
+ assert_equals("", audio_track.contentHint);
+
+ video_track = createVideoTrack();
+ assert_equals("", video_track.contentHint);
+}, "Tracks have empty default content hint");
+
+test(t => {
+ audio_track = createAudioTrack();
+ audio_track.contentHint = "speech";
+ assert_equals(audio_track.contentHint, "speech");
+ audio_track.contentHint = "music";
+ assert_equals(audio_track.contentHint, "music");
+ audio_track.contentHint = "";
+ assert_equals(audio_track.contentHint, "");
+}, "Accepts valid audio contentHints");
+
+test(t => {
+ audio_track = createAudioTrack();
+ audio_track.contentHint = "speech";
+ assert_equals(audio_track.contentHint, "speech");
+ audio_track.contentHint = "motion";
+ assert_equals(audio_track.contentHint, "speech",
+ "Audio tracks should ignore video-only contentHints.");
+ audio_track.contentHint = "bogus";
+ assert_equals(audio_track.contentHint, "speech",
+ "Audio tracks should ignore garbage contentHints");
+}, "Audio tracks ignore invalid/video contentHints");
+
+test(t => {
+ video_track = createVideoTrack();
+ video_track.contentHint = "motion";
+ assert_equals(video_track.contentHint, "motion");
+ video_track.contentHint = "detail";
+ assert_equals(video_track.contentHint, "detail");
+ video_track.contentHint = "text";
+ assert_equals(video_track.contentHint, "text");
+ video_track.contentHint = "";
+ assert_equals(video_track.contentHint, "");
+}, "Accepts valid video contentHints");
+
+test(t => {
+ video_track = createVideoTrack();
+ video_track.contentHint = "motion";
+ assert_equals(video_track.contentHint, "motion");
+ video_track.contentHint = "speech";
+ assert_equals(video_track.contentHint, "motion",
+ "Video tracks should ignore audio-only contentHints.");
+ video_track.contentHint = "bogus";
+ assert_equals(video_track.contentHint, "motion",
+ "Video tracks should ignore garbage contentHints");
+}, "Video tracks ignore invalid/audio contentHints");
+
+test(t => {
+ video_track = createVideoTrack();
+ video_track.contentHint = "motion";
+ assert_equals(video_track.contentHint, "motion");
+
+ // Cloning a track should preserve contentHint.
+ video_track_clone = video_track.clone();
+ assert_equals(video_track_clone.contentHint, "motion");
+
+ // Changing a cloned track's contentHint should not change the original.
+ video_track_clone.contentHint = "detail";
+ assert_equals(video_track_clone.contentHint, "detail");
+ assert_equals(video_track.contentHint, "motion");
+}, "Cloned video tracks have separate contentHints");
+
+test(t => {
+ audio_track = createAudioTrack();
+ audio_track.contentHint = "speech";
+ assert_equals(audio_track.contentHint, "speech");
+
+ // Cloning a track should preserve contentHint.
+ audio_track_clone = audio_track.clone();
+ assert_equals(audio_track_clone.contentHint, "speech");
+
+ // Changing a cloned track's contentHint should not change the original.
+ audio_track_clone.contentHint = "music";
+ assert_equals(audio_track_clone.contentHint, "music");
+ assert_equals(audio_track.contentHint, "speech");
+}, "Cloned audio tracks have separate contentHints");
+
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.html 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.js (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.js 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1,19 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+// META: script=/webrtc/RTCPeerConnection-helper.js
+
+'use strict';
+
+idl_test(
+ ['mst-content-hint'],
+ ['mediacapture-streams', 'dom'],
+ async idl_array => {
+ idl_array.add_objects({
+ MediaStreamTrack: ['audioTrack', 'videoTrack'],
+ });
+
+ const stream = await getNoiseStream({ audio: true, video: true });
+ self.audioTrack = stream.getAudioTracks()[0];
+ self.videoTrack = stream.getVideoTracks()[0];
+ }
+);
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/w3c-import.log (0 => 236367)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/w3c-import.log (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/w3c-import.log 2018-09-21 23:06:40 UTC (rev 236367)
@@ -0,0 +1,19 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+ https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/META.yml
+/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/MediaStreamTrack-contentHint.html
+/LayoutTests/imported/w3c/web-platform-tests/mst-content-hint/idlharness.window.js