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

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: Addressed alpha's comments 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..e1fc474f602972e23bc80e3cddc62e3a1655b4c5 100644
--- a/chrome/test/data/extensions/api_test/cast_streaming/basics.js
+++ b/chrome/test/data/extensions/api_test/cast_streaming/basics.js
@@ -17,6 +17,8 @@ function TestStateMachine(stream, audioId, videoId, udpId) {
this.videoStarted = false;
this.audioStopped = false;
this.videoStopped = false;
+ this.gotAudioRawEvents = false;
+ this.gotVideoRawEvents = false;
}
TestStateMachine.prototype.onStarted = function(id) {
@@ -37,6 +39,17 @@ TestStateMachine.prototype.onStopped = function(id) {
this.onAllStopped();
}
+TestStateMachine.prototype.onGotRawEvents = function(id, rawEvents) {
+ if (id == this.audioId) {
+ this.gotAudioRawEvents = true;
+ }
+ if (id == this.videoId) {
+ this.gotVideoRawEvents = true;
+ }
+ if (this.gotAudioRawEvents && this.gotVideoRawEvents)
+ this.onGotAllRawEvents();
+}
+
chrome.test.runTests([
function rtpStreamStart() {
console.log("[TEST] rtpStreamStart");
@@ -62,6 +75,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 +85,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