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

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

Issue 170063006: Cast: Add JS API to get raw events logs from cast extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass presubmit Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/cast_streaming/basics.js
diff --git a/chrome/test/data/extensions/api_test/cast_streaming/basics.js b/chrome/test/data/extensions/api_test/cast_streaming/basics.js
index d6d0bf45aea6b08e8c7e9c2de1d4c93711464b15..f6cd491f1403dc5eb68627b95d1022075441423c 100644
--- a/chrome/test/data/extensions/api_test/cast_streaming/basics.js
+++ b/chrome/test/data/extensions/api_test/cast_streaming/basics.js
@@ -8,35 +8,6 @@ var udpTransport = chrome.cast.streaming.udpTransport;
var createSession = chrome.cast.streaming.session.create;
var pass = chrome.test.callbackPass;
-function TestStateMachine(stream, audioId, videoId, udpId) {
- this.stream = stream;
- this.audioId = audioId;
- this.videoId = videoId;
- this.udpId = udpId;
- this.audioStarted = false;
- this.videoStarted = false;
- this.audioStopped = false;
- this.videoStopped = false;
-}
-
-TestStateMachine.prototype.onStarted = function(id) {
- if (id == this.audioId)
- this.audioStarted = true;
- if (id == this.videoId)
- this.videoStarted = true;
- if (this.audioStarted && this.videoStarted)
- this.onAllStarted();
-}
-
-TestStateMachine.prototype.onStopped = function(id) {
- if (id == this.audioId)
- this.audioStopped = true;
- if (id == this.videoId)
- this.videoStopped = true;
- if (this.audioStopped && this.videoStopped)
- this.onAllStopped();
-}
-
chrome.test.runTests([
function rtpStreamStart() {
console.log("[TEST] rtpStreamStart");
@@ -62,6 +33,9 @@ chrome.test.runTests([
stateMachine.onStarted.bind(stateMachine));
stateMachine.onAllStarted =
pass(function(audioId, videoId) {
+ console.log("Enabling logging.");
+ rtpStream.toggleLogging(audioId, true);
+ rtpStream.toggleLogging(videoId, true);
console.log("Stopping.");
rtpStream.stop(audioId);
rtpStream.stop(videoId);
@@ -69,7 +43,17 @@ chrome.test.runTests([
rtpStream.onStopped.addListener(
stateMachine.onStopped.bind(stateMachine));
stateMachine.onAllStopped =
+ pass(function(audioId, videoId) {
+ rtpStream.getRawEvents(audioId,
+ stateMachine.onGotRawEvents.bind(stateMachine, audioId));
+ rtpStream.getRawEvents(videoId,
+ stateMachine.onGotRawEvents.bind(stateMachine, videoId));
+ }.bind(null, audioId, videoId));
+ stateMachine.onGotAllRawEvents =
pass(function(stream, audioId, videoId, udpId) {
+ console.log("Disabling logging.");
+ rtpStream.toggleLogging(audioId, false);
+ rtpStream.toggleLogging(videoId, false);
console.log("Destroying.");
rtpStream.destroy(audioId);
rtpStream.destroy(videoId);

Powered by Google App Engine
This is Rietveld 408576698