OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var rtpStream = chrome.cast.streaming.rtpStream; | 5 var rtpStream = chrome.cast.streaming.rtpStream; |
6 var tabCapture = chrome.tabCapture; | 6 var tabCapture = chrome.tabCapture; |
7 var udpTransport = chrome.cast.streaming.udpTransport; | 7 var udpTransport = chrome.cast.streaming.udpTransport; |
8 var createSession = chrome.cast.streaming.session.create; | 8 var createSession = chrome.cast.streaming.session.create; |
9 var pass = chrome.test.callbackPass; | 9 var pass = chrome.test.callbackPass; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 chrome.test.assertTrue(audioId > 0); | 21 chrome.test.assertTrue(audioId > 0); |
22 chrome.test.assertTrue(videoId > 0); | 22 chrome.test.assertTrue(videoId > 0); |
23 chrome.test.assertTrue(udpId > 0); | 23 chrome.test.assertTrue(udpId > 0); |
24 console.log("Starting."); | 24 console.log("Starting."); |
25 var stateMachine = new TestStateMachine(stream, | 25 var stateMachine = new TestStateMachine(stream, |
26 audioId, | 26 audioId, |
27 videoId, | 27 videoId, |
28 udpId); | 28 udpId); |
29 var audioParams = rtpStream.getSupportedParams(audioId)[0]; | 29 var audioParams = rtpStream.getSupportedParams(audioId)[0]; |
30 var videoParams = rtpStream.getSupportedParams(videoId)[0]; | 30 var videoParams = rtpStream.getSupportedParams(videoId)[0]; |
31 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 31 chrome.test.assertTrue(!!audioParams.payload.codecName); |
32 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 32 chrome.test.assertTrue(!!videoParams.payload.codecName); |
33 udpTransport.setDestination(udpId, | 33 udpTransport.setDestination(udpId, |
34 {address: "127.0.0.1", port: 2344}); | 34 {address: "127.0.0.1", port: 2344}); |
35 rtpStream.onStarted.addListener( | 35 rtpStream.onStarted.addListener( |
36 stateMachine.onStarted.bind(stateMachine)); | 36 stateMachine.onStarted.bind(stateMachine)); |
37 stateMachine.onAllStarted = | 37 stateMachine.onAllStarted = |
38 pass(function(audioId, videoId) { | 38 pass(function(audioId, videoId) { |
39 console.log("Enabling logging."); | 39 console.log("Enabling logging."); |
40 rtpStream.toggleLogging(audioId, true); | 40 rtpStream.toggleLogging(audioId, true); |
41 rtpStream.toggleLogging(videoId, true); | 41 rtpStream.toggleLogging(videoId, true); |
42 console.log("Stopping."); | 42 console.log("Stopping."); |
(...skipping 13 matching lines...) Expand all Loading... |
56 }.bind(null, audioId, videoId)); | 56 }.bind(null, audioId, videoId)); |
57 stateMachine.onGotAllLogs = | 57 stateMachine.onGotAllLogs = |
58 pass(function(stream, audioId, videoId, udpId) { | 58 pass(function(stream, audioId, videoId, udpId) { |
59 console.log("Disabling logging."); | 59 console.log("Disabling logging."); |
60 rtpStream.toggleLogging(audioId, false); | 60 rtpStream.toggleLogging(audioId, false); |
61 rtpStream.toggleLogging(videoId, false); | 61 rtpStream.toggleLogging(videoId, false); |
62 console.log("Destroying."); | 62 console.log("Destroying."); |
63 rtpStream.destroy(audioId); | 63 rtpStream.destroy(audioId); |
64 rtpStream.destroy(videoId); | 64 rtpStream.destroy(videoId); |
65 udpTransport.destroy(udpId); | 65 udpTransport.destroy(udpId); |
66 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 66 chrome.test.assertTrue(!!audioParams.payload.codecName); |
67 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 67 chrome.test.assertTrue(!!videoParams.payload.codecName); |
68 chrome.test.succeed(); | 68 chrome.test.succeed(); |
69 }.bind(null, stream, audioId, videoId, udpId)); | 69 }.bind(null, stream, audioId, videoId, udpId)); |
70 rtpStream.start(audioId, audioParams); | 70 rtpStream.start(audioId, audioParams); |
71 rtpStream.start(videoId, videoParams); | 71 rtpStream.start(videoId, videoParams); |
72 }.bind(null, stream))); | 72 }.bind(null, stream))); |
73 })); | 73 })); |
74 }, | 74 }, |
75 ]); | 75 ]); |
OLD | NEW |