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 |
11 chrome.test.runTests([ | 11 chrome.test.runTests([ |
12 function emptyLogWithLoggingDisabled() { | 12 function emptyLogWithLoggingDisabled() { |
13 | 13 |
14 console.log("[TEST] emptyLogWithLoggingDisabled"); | 14 console.log("[TEST] emptyLogWithLoggingDisabled"); |
15 tabCapture.capture({audio: true, video: true}, | 15 tabCapture.capture({audio: true, video: true}, |
16 pass(function(stream) { | 16 pass(function(stream) { |
17 console.log("Got MediaStream."); | 17 console.log("Got MediaStream."); |
18 chrome.test.assertTrue(!!stream); | 18 chrome.test.assertTrue(!!stream); |
19 createSession(stream.getAudioTracks()[0], | 19 createSession(stream.getAudioTracks()[0], |
20 stream.getVideoTracks()[0], | 20 stream.getVideoTracks()[0], |
21 pass(function(stream, audioId, videoId, udpId) { | 21 pass(function(stream, audioId, videoId, udpId) { |
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("", rawEvents); | 30 chrome.test.assertEq(0, rawEvents.byteLength); |
31 } | 31 } |
32 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 32 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); |
33 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 33 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); |
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."); |
(...skipping 17 matching lines...) Expand all Loading... |
58 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); | 58 chrome.test.assertEq(audioParams.payload.codecName, "OPUS"); |
59 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); | 59 chrome.test.assertEq(videoParams.payload.codecName, "VP8"); |
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 |