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