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
3 // found in the LICENSE file.
5 var rtpStream
= chrome
.cast
.streaming
.rtpStream
;
6 var tabCapture
= chrome
.tabCapture
;
7 var udpTransport
= chrome
.cast
.streaming
.udpTransport
;
8 var createSession
= chrome
.cast
.streaming
.session
.create
;
9 var pass
= chrome
.test
.callbackPass
;
11 chrome
.test
.runTests([
13 console
.log("[TEST] noVideo");
14 chrome
.tabs
.create({"url": "about:blank"}, pass(function(tab
) {
15 tabCapture
.capture({audio
: true, video
: false},
16 pass(function(stream
) {
17 chrome
.test
.assertTrue(!!stream
);
18 createSession(stream
.getAudioTracks()[0],
20 pass(function(stream
, audioId
, videoId
, udpId
) {
21 chrome
.test
.assertTrue(audioId
> 0);
22 chrome
.test
.assertTrue(videoId
== null);
23 chrome
.test
.assertTrue(udpId
> 0);
24 rtpStream
.destroy(audioId
);
25 udpTransport
.destroy(udpId
);
26 }.bind(null, stream
)));
31 console
.log("[TEST] noAudio");
32 chrome
.tabs
.create({"url": "about:blank"}, pass(function(tab
) {
33 tabCapture
.capture({audio
: false, video
: true},
34 pass(function(stream
) {
35 chrome
.test
.assertTrue(!!stream
);
37 stream
.getVideoTracks()[0],
38 pass(function(stream
, audioId
, videoId
, udpId
) {
39 chrome
.test
.assertTrue(audioId
== null);
40 chrome
.test
.assertTrue(videoId
> 0);
41 chrome
.test
.assertTrue(udpId
> 0);
42 rtpStream
.destroy(videoId
);
43 udpTransport
.destroy(udpId
);
44 }.bind(null, stream
)));
49 console
.log("[TEST] noAudio");
50 chrome
.tabs
.create({"url": "about:blank"}, pass(function(tab
) {
52 createSession(null, null, function(a
, b
, c
) {});