| Index: chrome/test/data/extensions/api_test/cast_streaming/null_stream.js
|
| diff --git a/chrome/test/data/extensions/api_test/cast_streaming/null_stream.js b/chrome/test/data/extensions/api_test/cast_streaming/null_stream.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7974954ebd05e5259c3e25ab70d05ac7d5ea308c
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/cast_streaming/null_stream.js
|
| @@ -0,0 +1,59 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +var rtpStream = chrome.cast.streaming.rtpStream;
|
| +var tabCapture = chrome.tabCapture;
|
| +var udpTransport = chrome.cast.streaming.udpTransport;
|
| +var createSession = chrome.cast.streaming.session.create;
|
| +var pass = chrome.test.callbackPass;
|
| +
|
| +chrome.test.runTests([
|
| + function noVideo() {
|
| + console.log("[TEST] noVideo");
|
| + chrome.tabs.create({"url": "about:blank"}, pass(function(tab) {
|
| + tabCapture.capture({audio: true, video: false},
|
| + pass(function(stream) {
|
| + chrome.test.assertTrue(!!stream);
|
| + createSession(stream.getAudioTracks()[0],
|
| + null,
|
| + pass(function(stream, audioId, videoId, udpId) {
|
| + chrome.test.assertTrue(audioId > 0);
|
| + chrome.test.assertTrue(videoId == null);
|
| + chrome.test.assertTrue(udpId > 0);
|
| + rtpStream.destroy(audioId);
|
| + udpTransport.destroy(udpId);
|
| + }.bind(null, stream)));
|
| + }));
|
| + }));
|
| + },
|
| + function noAudio() {
|
| + console.log("[TEST] noAudio");
|
| + chrome.tabs.create({"url": "about:blank"}, pass(function(tab) {
|
| + tabCapture.capture({audio: false, video: true},
|
| + pass(function(stream) {
|
| + chrome.test.assertTrue(!!stream);
|
| + createSession(null,
|
| + stream.getVideoTracks()[0],
|
| + pass(function(stream, audioId, videoId, udpId) {
|
| + chrome.test.assertTrue(audioId == null);
|
| + chrome.test.assertTrue(videoId > 0);
|
| + chrome.test.assertTrue(udpId > 0);
|
| + rtpStream.destroy(videoId);
|
| + udpTransport.destroy(udpId);
|
| + }.bind(null, stream)));
|
| + }));
|
| + }));
|
| + },
|
| + function noStream() {
|
| + console.log("[TEST] noAudio");
|
| + chrome.tabs.create({"url": "about:blank"}, pass(function(tab) {
|
| + try {
|
| + createSession(null, null, function(a, b, c) {});
|
| + chrome.test.fail();
|
| + } catch (e) {
|
| + // Success.
|
| + }
|
| + }));
|
| + },
|
| +]);
|
|
|