| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <canvas id="canvas"> |
| 5 </canvas> |
| 6 <script> |
| 7 |
| 8 function createAudioTrack() { |
| 9 ac = new AudioContext(); |
| 10 var osc = ac.createOscillator(); |
| 11 var dest = ac.createMediaStreamDestination(); |
| 12 osc.connect(dest); |
| 13 audio_track = dest.stream.getAudioTracks()[0]; |
| 14 |
| 15 assert_equals(audio_track.kind, "audio"); |
| 16 return audio_track; |
| 17 } |
| 18 |
| 19 function createVideoTrack() { |
| 20 canvas = document.getElementById("canvas"); |
| 21 video_track = canvas.captureStream().getVideoTracks()[0]; |
| 22 |
| 23 assert_equals(video_track.kind, "video"); |
| 24 return video_track; |
| 25 } |
| 26 |
| 27 test(t => { |
| 28 audio_track = createAudioTrack(); |
| 29 assert_equals("", audio_track.contentHint); |
| 30 |
| 31 video_track = createVideoTrack(); |
| 32 assert_equals("", video_track.contentHint); |
| 33 }, "Tracks have empty default content hint"); |
| 34 |
| 35 test(t => { |
| 36 audio_track = createAudioTrack(); |
| 37 audio_track.contentHint = "speech"; |
| 38 assert_equals(audio_track.contentHint, "speech"); |
| 39 audio_track.contentHint = "music"; |
| 40 assert_equals(audio_track.contentHint, "music"); |
| 41 audio_track.contentHint = ""; |
| 42 assert_equals(audio_track.contentHint, ""); |
| 43 }, "Accepts valid audio contentHints"); |
| 44 |
| 45 test(t => { |
| 46 audio_track = createAudioTrack(); |
| 47 audio_track.contentHint = "speech"; |
| 48 assert_equals(audio_track.contentHint, "speech"); |
| 49 audio_track.contentHint = "fluid"; |
| 50 assert_equals(audio_track.contentHint, "speech", |
| 51 "Audio tracks should ignore video-only contentHints."); |
| 52 audio_track.contentHint = "bogus"; |
| 53 assert_equals(audio_track.contentHint, "speech", |
| 54 "Audio tracks should ignore garbage contentHints"); |
| 55 }, "Audio tracks ignore invalid/video contentHints"); |
| 56 |
| 57 test(t => { |
| 58 video_track = createVideoTrack(); |
| 59 video_track.contentHint = "fluid"; |
| 60 assert_equals(video_track.contentHint, "fluid"); |
| 61 video_track.contentHint = "detailed"; |
| 62 assert_equals(video_track.contentHint, "detailed"); |
| 63 video_track.contentHint = ""; |
| 64 assert_equals(video_track.contentHint, ""); |
| 65 }, "Accepts valid video contentHints"); |
| 66 |
| 67 test(t => { |
| 68 video_track = createVideoTrack(); |
| 69 video_track.contentHint = "fluid"; |
| 70 assert_equals(video_track.contentHint, "fluid"); |
| 71 video_track.contentHint = "speech"; |
| 72 assert_equals(video_track.contentHint, "fluid", |
| 73 "Video tracks should ignore audio-only contentHints."); |
| 74 video_track.contentHint = "bogus"; |
| 75 assert_equals(video_track.contentHint, "fluid", |
| 76 "Video tracks should ignore garbage contentHints"); |
| 77 }, "Video tracks ignore invalid/audio contentHints"); |
| 78 |
| 79 test(t => { |
| 80 video_track = createVideoTrack(); |
| 81 video_track.contentHint = "fluid"; |
| 82 assert_equals(video_track.contentHint, "fluid"); |
| 83 |
| 84 // Cloning a track should preserve contentHint. |
| 85 video_track_clone = video_track.clone(); |
| 86 assert_equals(video_track_clone.contentHint, "fluid"); |
| 87 |
| 88 // Changing a cloned track's contentHint should not change the original. |
| 89 video_track_clone.contentHint = "detailed"; |
| 90 assert_equals(video_track_clone.contentHint, "detailed"); |
| 91 assert_equals(video_track.contentHint, "fluid"); |
| 92 }, "Cloned video tracks have separate contentHints"); |
| 93 |
| 94 test(t => { |
| 95 audio_track = createAudioTrack(); |
| 96 audio_track.contentHint = "speech"; |
| 97 assert_equals(audio_track.contentHint, "speech"); |
| 98 |
| 99 // Cloning a track should preserve contentHint. |
| 100 audio_track_clone = audio_track.clone(); |
| 101 assert_equals(audio_track_clone.contentHint, "speech"); |
| 102 |
| 103 // Changing a cloned track's contentHint should not change the original. |
| 104 audio_track_clone.contentHint = "music"; |
| 105 assert_equals(audio_track_clone.contentHint, "music"); |
| 106 assert_equals(audio_track.contentHint, "speech"); |
| 107 }, "Cloned audio tracks have separate contentHints"); |
| 108 |
| 109 </script> |
| OLD | NEW |