Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream.html

Issue 650063002: Move MediaStream and MediaStreamTrack implementation from modules/mediastream to core/mediastream. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Tests RTCPeerConnection [add|remove]Stream.");
9
10 var stream = null;
11 var stream2 = null;
12 var pc = null;
13
14 function error() {
15 testFailed('Stream generation failed.');
16 finishJSTest();
17 }
18
19 function getUserMedia(dictionary, callback) {
20 try {
21 navigator.webkitGetUserMedia(dictionary, callback, error);
22 } catch (e) {
23 testFailed('webkitGetUserMedia threw exception :' + e);
24 finishJSTest();
25 }
26 }
27
28 function onErroneousNegotiationNeeded() {
29 testFailed('onErroneousNegotiationNeeded was called.');
30 finishJSTest();
31 }
32
33 function onRemoveStream(event) {
34 testPassed('onRemoveStream was called.');
35
36 shouldBe('pc.getLocalStreams().length', '0');
37
38 finishJSTest();
39 }
40
41 function onAddStream(event) {
42 testPassed('onAddStream was called.');
43
44 shouldBe('pc.getStreamById(stream.id)', 'stream');
45 shouldBe('pc.getStreamById(stream2.id)', 'null');
46
47 pc.onnegotiationneeded = onErroneousNegotiationNeeded;
48 pc.addStream(stream);
49 shouldBe('pc.getLocalStreams().length', '1');
50 pc.removeStream(stream2);
51 shouldBe('pc.getLocalStreams().length', '1');
52
53 pc.onnegotiationneeded = onRemoveStream;
54 pc.removeStream(stream);
55 }
56
57 function gotStream2(s) {
58 testPassed('Got another stream.');
59 stream2 = s;
60
61 shouldBeFalse("stream.id === stream2.id");
62
63 pc = new webkitRTCPeerConnection(null, null);
64 pc.onnegotiationneeded = onAddStream;
65 pc.addStream(stream);
66 }
67
68 function gotStream1(s) {
69 testPassed('Got a stream.');
70 stream = s;
71
72 getUserMedia({audio:true, video:true}, gotStream2);
73 }
74
75 getUserMedia({audio:true, video:true}, gotStream1);
76
77 window.jsTestIsAsync = true;
78 window.successfullyParsed = true;
79 </script>
80 </body>
81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698