| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 11 matching lines...) Expand all Loading... |
| 22 console.log("Starting."); | 22 console.log("Starting."); |
| 23 var stateMachine = new TestStateMachine(stream, | 23 var stateMachine = new TestStateMachine(stream, |
| 24 audioId, | 24 audioId, |
| 25 videoId, | 25 videoId, |
| 26 udpId); | 26 udpId); |
| 27 var audioParams = rtpStream.getSupportedParams(audioId)[0]; | 27 var audioParams = rtpStream.getSupportedParams(audioId)[0]; |
| 28 var videoParams = rtpStream.getSupportedParams(videoId)[0]; | 28 var videoParams = rtpStream.getSupportedParams(videoId)[0]; |
| 29 var expectEmptyLogs = function(rawEvents) { | 29 var expectEmptyLogs = function(rawEvents) { |
| 30 chrome.test.assertEq(0, rawEvents.byteLength); | 30 chrome.test.assertEq(0, rawEvents.byteLength); |
| 31 } | 31 } |
| 32 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 32 chrome.test.assertTrue(!!audioParams.payload.codecName); |
| 33 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 33 chrome.test.assertTrue(!!videoParams.payload.codecName); |
| 34 udpTransport.setDestination(udpId, | 34 udpTransport.setDestination(udpId, |
| 35 {address: "127.0.0.1", port: 2344}); | 35 {address: "127.0.0.1", port: 2344}); |
| 36 rtpStream.onStarted.addListener( | 36 rtpStream.onStarted.addListener( |
| 37 stateMachine.onStarted.bind(stateMachine)); | 37 stateMachine.onStarted.bind(stateMachine)); |
| 38 stateMachine.onAllStarted = | 38 stateMachine.onAllStarted = |
| 39 pass(function(audioId, videoId) { | 39 pass(function(audioId, videoId) { |
| 40 console.log("Getting logs without enabling logging."); | 40 console.log("Getting logs without enabling logging."); |
| 41 rtpStream.getRawEvents(audioId, expectEmptyLogs); | 41 rtpStream.getRawEvents(audioId, expectEmptyLogs); |
| 42 rtpStream.getRawEvents(videoId, expectEmptyLogs); | 42 rtpStream.getRawEvents(videoId, expectEmptyLogs); |
| 43 console.log("Disabling logging that is already disabled."); | 43 console.log("Disabling logging that is already disabled."); |
| 44 rtpStream.toggleLogging(audioId, false); | 44 rtpStream.toggleLogging(audioId, false); |
| 45 rtpStream.toggleLogging(videoId, false); | 45 rtpStream.toggleLogging(videoId, false); |
| 46 console.log("Stopping."); | 46 console.log("Stopping."); |
| 47 rtpStream.stop(audioId); | 47 rtpStream.stop(audioId); |
| 48 rtpStream.stop(videoId); | 48 rtpStream.stop(videoId); |
| 49 }.bind(null, audioId, videoId)); | 49 }.bind(null, audioId, videoId)); |
| 50 rtpStream.onStopped.addListener( | 50 rtpStream.onStopped.addListener( |
| 51 stateMachine.onStopped.bind(stateMachine)); | 51 stateMachine.onStopped.bind(stateMachine)); |
| 52 stateMachine.onAllStopped = | 52 stateMachine.onAllStopped = |
| 53 pass(function(stream, audioId, videoId, udpId) { | 53 pass(function(stream, audioId, videoId, udpId) { |
| 54 console.log("Destroying."); | 54 console.log("Destroying."); |
| 55 rtpStream.destroy(audioId); | 55 rtpStream.destroy(audioId); |
| 56 rtpStream.destroy(videoId); | 56 rtpStream.destroy(videoId); |
| 57 udpTransport.destroy(udpId); | 57 udpTransport.destroy(udpId); |
| 58 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 58 chrome.test.assertTrue(!!audioParams.payload.codecName); |
| 59 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 59 chrome.test.assertTrue(!!videoParams.payload.codecName); |
| 60 chrome.test.succeed(); | 60 chrome.test.succeed(); |
| 61 }.bind(null, stream, audioId, videoId, udpId)); | 61 }.bind(null, stream, audioId, videoId, udpId)); |
| 62 rtpStream.start(audioId, audioParams); | 62 rtpStream.start(audioId, audioParams); |
| 63 rtpStream.start(videoId, videoParams); | 63 rtpStream.start(videoId, videoParams); |
| 64 }.bind(null, stream))); | 64 }.bind(null, stream))); |
| 65 })); | 65 })); |
| 66 }, | 66 }, |
| 67 ]); | 67 ]); |
| OLD | NEW |