Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: chrome/test/data/extensions/api_test/cast_streaming/basics.js

Issue 121543003: Set AES key and IV mask to CastSender (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 10
10 chrome.test.runTests([ 11 chrome.test.runTests([
11 function rtpStreamStart() { 12 function rtpStreamStart() {
12 tabCapture.capture({audio: true, video: true}, function(stream) { 13 console.log("[TEST] rtpStreamStart");
14 tabCapture.capture({audio: true, video: true},
15 pass(function(stream) {
13 console.log("Got MediaStream."); 16 console.log("Got MediaStream.");
14 chrome.test.assertTrue(!!stream); 17 chrome.test.assertTrue(!!stream);
15 createSession(stream.getAudioTracks()[0], 18 createSession(stream.getAudioTracks()[0],
16 stream.getVideoTracks()[0], 19 stream.getVideoTracks()[0],
17 function(stream, audioId, videoId, udpId) { 20 pass(function(stream, audioId, videoId, udpId) {
18 console.log("Starting."); 21 console.log("Starting.");
19 var audioParams = rtpStream.getCaps(audioId); 22 var audioParams = rtpStream.getCaps(audioId);
20 var videoParams = rtpStream.getCaps(videoId); 23 var videoParams = rtpStream.getCaps(videoId);
21 rtpStream.start(audioId, audioParams); 24 rtpStream.start(audioId, audioParams);
22 rtpStream.start(videoId, videoParams); 25 rtpStream.start(videoId, videoParams);
23 udpTransport.start(udpId, {address: "127.0.0.1", port: 2344}); 26 udpTransport.start(udpId, {address: "127.0.0.1", port: 2344});
24 window.setTimeout(function() { 27 window.setTimeout(pass(function() {
25 console.log("Stopping."); 28 console.log("Stopping.");
26 rtpStream.stop(audioId); 29 rtpStream.stop(audioId);
27 rtpStream.stop(videoId); 30 rtpStream.stop(videoId);
28 rtpStream.destroy(audioId); 31 rtpStream.destroy(audioId);
29 rtpStream.destroy(videoId); 32 rtpStream.destroy(videoId);
30 udpTransport.destroy(udpId); 33 udpTransport.destroy(udpId);
31 stream.stop(); 34 stream.stop();
32 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS"); 35 chrome.test.assertEq(audioParams.payloads[0].codecName, "OPUS");
33 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8"); 36 chrome.test.assertEq(videoParams.payloads[0].codecName, "VP8");
34 chrome.test.succeed(); 37 chrome.test.succeed();
35 }, 0); 38 }), 0);
36 }.bind(null, stream)); 39 }.bind(null, stream)));
37 }); 40 }));
41 },
42 function invalidKey() {
43 console.log("[TEST] invalidKey");
44 tabCapture.capture({audio: true, video: true},
45 pass(function(stream) {
46 chrome.test.assertTrue(!!stream);
47 createSession(stream.getAudioTracks()[0],
48 stream.getVideoTracks()[0],
49 pass(function(stream, audioId, videoId, udpId) {
50 // AES key is invalid and exception is expected.
51 try {
52 var audioParams = rtpStream.getCaps(audioId);
53 var videoParams = rtpStream.getCaps(videoId);
54 audioParams.payloads[0].aesKey = "google";
55 videoParams.payloads[0].aesIvMask = "chrome";
56 rtpStream.start(audioId, audioParams);
57 rtpStream.start(videoId, videoParams);
58 } catch (e) {
59 rtpStream.destroy(audioId);
60 rtpStream.destroy(videoId);
61 udpTransport.destroy(udpId);
62 stream.stop();
63 chrome.test.succeed();
64 }
65 }.bind(null, stream)));
66 }));
38 }, 67 },
39 ]); 68 ]);
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_rtp_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698