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 27 matching lines...) Expand all Loading... | |
38 rtpStream.toggleLogging(videoId, true); | 38 rtpStream.toggleLogging(videoId, true); |
39 console.log("Stopping."); | 39 console.log("Stopping."); |
40 rtpStream.stop(audioId); | 40 rtpStream.stop(audioId); |
41 rtpStream.stop(videoId); | 41 rtpStream.stop(videoId); |
42 }.bind(null, audioId, videoId)); | 42 }.bind(null, audioId, videoId)); |
43 rtpStream.onStopped.addListener( | 43 rtpStream.onStopped.addListener( |
44 stateMachine.onStopped.bind(stateMachine)); | 44 stateMachine.onStopped.bind(stateMachine)); |
45 stateMachine.onAllStopped = | 45 stateMachine.onAllStopped = |
46 pass(function(audioId, videoId) { | 46 pass(function(audioId, videoId) { |
47 rtpStream.getRawEvents(audioId, | 47 rtpStream.getRawEvents(audioId, |
48 stateMachine.onGotRawEvents.bind(stateMachine, audioId)); | 48 stateMachine.onGotLogs.bind(stateMachine, audioId, false)); |
Alpha Left Google
2014/03/03 07:11:39
This test is already complicated. I'd refer getSta
imcheng
2014/03/04 02:06:24
Done.
| |
49 rtpStream.getRawEvents(videoId, | 49 rtpStream.getRawEvents(videoId, |
50 stateMachine.onGotRawEvents.bind(stateMachine, videoId)); | 50 stateMachine.onGotLogs.bind(stateMachine, videoId, false)); |
51 rtpStream.getStats(audioId, | |
52 stateMachine.onGotLogs.bind(stateMachine, audioId, true)); | |
53 rtpStream.getStats(videoId, | |
54 stateMachine.onGotLogs.bind(stateMachine, videoId, true)); | |
51 }.bind(null, audioId, videoId)); | 55 }.bind(null, audioId, videoId)); |
52 stateMachine.onGotAllRawEvents = | 56 stateMachine.onGotAllLogs = |
53 pass(function(stream, audioId, videoId, udpId) { | 57 pass(function(stream, audioId, videoId, udpId) { |
54 console.log("Disabling logging."); | 58 console.log("Disabling logging."); |
55 rtpStream.toggleLogging(audioId, false); | 59 rtpStream.toggleLogging(audioId, false); |
56 rtpStream.toggleLogging(videoId, false); | 60 rtpStream.toggleLogging(videoId, false); |
57 console.log("Destroying."); | 61 console.log("Destroying."); |
58 rtpStream.destroy(audioId); | 62 rtpStream.destroy(audioId); |
59 rtpStream.destroy(videoId); | 63 rtpStream.destroy(videoId); |
60 udpTransport.destroy(udpId); | 64 udpTransport.destroy(udpId); |
61 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 65 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); |
62 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 66 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); |
63 chrome.test.succeed(); | 67 chrome.test.succeed(); |
64 }.bind(null, stream, audioId, videoId, udpId)); | 68 }.bind(null, stream, audioId, videoId, udpId)); |
65 rtpStream.start(audioId, audioParams); | 69 rtpStream.start(audioId, audioParams); |
66 rtpStream.start(videoId, videoParams); | 70 rtpStream.start(videoId, videoParams); |
67 }.bind(null, stream))); | 71 }.bind(null, stream))); |
68 })); | 72 })); |
69 }, | 73 }, |
70 ]); | 74 ]); |
OLD | NEW |