OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 var testRTC = async_test('Tests RTCPeerConnection [add|remove]Stream.'); | 9 var testRTC = async_test('Tests RTCPeerConnection [add|remove]Stream.'); |
10 | 10 |
11 var pc = null; | 11 var pc = null; |
12 var options = {audio: true, video: true}; | 12 var options = {audio: true, video: true}; |
13 var errorCallback = () => assert_unreached('Stream generation failed.'); | 13 var errorCallback = () => assert_unreached('Stream generation failed.'); |
14 | 14 |
15 navigator.webkitGetUserMedia(options, (stream1) => { | 15 navigator.webkitGetUserMedia(options, (stream1) => { |
16 navigator.webkitGetUserMedia(options, (stream2) => { | 16 navigator.webkitGetUserMedia(options, (stream2) => { |
17 assert_false(stream1.id === stream2.id); | 17 assert_false(stream1.id === stream2.id); |
18 | 18 |
19 pc = new webkitRTCPeerConnection(null, null); | 19 pc = new RTCPeerConnection(); |
20 | 20 |
21 pc.onnegotiationneeded = (event) => { | 21 pc.onnegotiationneeded = (event) => { |
22 assert_equals(pc.getStreamById(stream1.id), stream1); | 22 assert_equals(pc.getStreamById(stream1.id), stream1); |
23 assert_equals(pc.getStreamById(stream2.id), null); | 23 assert_equals(pc.getStreamById(stream2.id), null); |
24 | 24 |
25 pc.onnegotiationneeded = () => { | 25 pc.onnegotiationneeded = () => { |
26 assert_unreached('onErroneousNegotiationNeeded was called.'); | 26 assert_unreached('onErroneousNegotiationNeeded was called.'); |
27 }; | 27 }; |
28 | 28 |
29 pc.addStream(stream1); | 29 pc.addStream(stream1); |
30 assert_equals(pc.getLocalStreams().length, 1); | 30 assert_equals(pc.getLocalStreams().length, 1); |
31 pc.removeStream(stream2); | 31 pc.removeStream(stream2); |
32 assert_equals(pc.getLocalStreams().length, 1); | 32 assert_equals(pc.getLocalStreams().length, 1); |
33 | 33 |
34 pc.onnegotiationneeded = (event) => { | 34 pc.onnegotiationneeded = (event) => { |
35 assert_equals(pc.getLocalStreams().length, 0); | 35 assert_equals(pc.getLocalStreams().length, 0); |
36 testRTC.done(); | 36 testRTC.done(); |
37 }; | 37 }; |
38 pc.removeStream(stream1); | 38 pc.removeStream(stream1); |
39 }; | 39 }; |
40 | 40 |
41 pc.addStream(stream1); | 41 pc.addStream(stream1); |
42 }, errorCallback); | 42 }, errorCallback); |
43 }, errorCallback); | 43 }, errorCallback); |
44 </script> | 44 </script> |
45 </body> | 45 </body> |
46 </html> | 46 </html> |
OLD | NEW |