Bug 1483784 [wpt PR 12516] - Enable the "Content hint" attribute of MediaStreamTrack, a=testonly
authorHarald Alvestrand <hta@chromium.org>
Fri, 17 Aug 2018 22:02:49 +0000
changeset 487485 bd7bd36d5ef40b5aa029d736678c8682d5e7b7a3
parent 487484 5c5b8149502471859693734e3f7cf9c27d58a407
child 487486 3898f5a8ddea4f18c71aac125e509957374a2c7d
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1483784, 12516, 653531, 1175124, 583585
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483784 [wpt PR 12516] - Enable the "Content hint" attribute of MediaStreamTrack, a=testonly Automatic update from web-platform-testsEnable the "Content hint" attribute of MediaStreamTrack Also moves a test from internal to public repo. Bug: chromium:653531 Change-Id: I99224f86fb9abb44784c861b6c2ba0b3c9e020c4 Reviewed-on: https://chromium-review.googlesource.com/1175124 Reviewed-by: Philip J├Ągenstedt <foolip@chromium.org> Commit-Queue: Harald Alvestrand <hta@chromium.org> Cr-Commit-Position: refs/heads/master@{#583585} -- wpt-commits: eb51da896316fc87bef0ad3f9984c3ca8e550c61 wpt-pr: 12516
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/mst-content-hint/MediaStreamTrack-contentHint.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -368113,16 +368113,22 @@
     ]
    ],
    "mixed-content/xhr-request/no-opt-in/same-host-https/top-level/no-redirect/allowed/allowed.https.html": [
     [
      "/mixed-content/xhr-request/no-opt-in/same-host-https/top-level/no-redirect/allowed/allowed.https.html",
      {}
     ]
    ],
+   "mst-content-hint/MediaStreamTrack-contentHint.html": [
+    [
+     "/mst-content-hint/MediaStreamTrack-contentHint.html",
+     {}
+    ]
+   ],
    "mst-content-hint/idlharness.window.js": [
     [
      "/mst-content-hint/idlharness.window.html",
      {}
     ]
    ],
    "navigation-timing/idlharness.window.js": [
     [
@@ -609698,16 +609704,20 @@
   "mixed-content/xhr-request/no-opt-in/same-host-https/top-level/no-redirect/allowed/allowed.https.html": [
    "b0fff36eb94609ac24a76121bf9e201234885db1",
    "testharness"
   ],
   "mst-content-hint/META.yml": [
    "7f79eccbaa6b9950233ee8968c6b358dd89b5d03",
    "support"
   ],
+  "mst-content-hint/MediaStreamTrack-contentHint.html": [
+   "98c88e66ea1ec137cdcf794c63a14d9af4b964b1",
+   "testharness"
+  ],
   "mst-content-hint/idlharness.window.js": [
    "0d9137dc6fb91b1499d922e01d6ad96049f5757b",
    "testharness"
   ],
   "navigation-timing/META.yml": [
    "c09a6e03fd19f5a405b391c2c4671df6ff04edf1",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/mst-content-hint/MediaStreamTrack-contentHint.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>