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); |