Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / cast_streaming / destination_not_set.js
blob3d37987f3e56daa90341373f8e33955845da17df
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([
12   function rtpStreamStart() {
13     console.log("[TEST] rtpStreamStart");
14     tabCapture.capture({audio: true, video: true},
15                        pass(function(stream) {
16       console.log("Got MediaStream.");
17       chrome.test.assertTrue(!!stream);
18       createSession(stream.getAudioTracks()[0],
19                     stream.getVideoTracks()[0],
20                     pass(function(stream, audioId, videoId, udpId) {
21         console.log("Starting.");
22         var stateMachine = new TestStateMachine(stream,
23                                                 audioId,
24                                                 videoId,
25                                                 udpId);
26         var audioParams = rtpStream.getSupportedParams(audioId)[0];
27         chrome.test.assertTrue(!!audioParams.payload.codecName);
28         var expectError = function(id, message) {
29           chrome.test.assertEq("Destination not set.", message);
30           chrome.test.succeed();
31         }
32         console.log("Starting RTP stream before setting destination.");
33         rtpStream.onError.addListener(expectError);
34         rtpStream.start(audioId, audioParams);
35       }.bind(null, stream)));
36     }));
37   },
38 ]);