youenn@apple.com | 6b19492 | 2018-04-11 21:49:28 +0000 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>Testing UTF-8 content in SDP</title> |
| 6 | <script src="../resources/testharness.js"></script> |
| 7 | <script src="../resources/testharnessreport.js"></script> |
| 8 | </head> |
| 9 | <body> |
| 10 | <video id="video" autoplay=""></video> |
| 11 | <script src ="routines.js"></script> |
| 12 | <script> |
| 13 | promise_test(async (test) => { |
| 14 | if (!window.internals) |
| 15 | return Promise.reject("internals required"); |
| 16 | |
| 17 | const unicodeString = '世界你好'; |
| 18 | |
| 19 | const stream = await navigator.mediaDevices.getUserMedia({video: true}); |
| 20 | internals.setMediaStreamTrackIdentifier(stream.getVideoTracks()[0], unicodeString); |
| 21 | |
| 22 | const remoteStream = await new Promise((resolve, reject) => { |
| 23 | createConnections((firstConnection) => { |
| 24 | firstConnection.addTrack(stream.getVideoTracks()[0], stream); |
| 25 | }, (secondConnection) => { |
| 26 | secondConnection.ontrack = (trackEvent) => { |
| 27 | resolve(trackEvent.streams[0]); |
| 28 | }; |
| 29 | }); |
| 30 | setTimeout(() => reject("Test timed out"), 5000); |
| 31 | }); |
| 32 | |
| 33 | assert_equals(unicodeString, remoteStream.getVideoTracks()[0].id); |
| 34 | video.srcObject = remoteStream; |
| 35 | return video.play(); |
| 36 | }, "Testing video exchange with UTF-8 track id"); |
| 37 | </script> |
| 38 | </body> |
| 39 | </html> |