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

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: 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..003f0e0f5a908a6aeb8ea61d6e56e4c52d805c28 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("Starting logging.");
+ rtpStream.startLogging(audioId);
+ rtpStream.startLogging(videoId);
console.log("Stopping.");
rtpStream.stop(audioId);
rtpStream.stop(videoId);
@@ -69,6 +85,13 @@ 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("Destroying.");
rtpStream.destroy(audioId);

Powered by Google App Engine
This is Rietveld 408576698