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

Unified Diff: chrome/test/data/extensions/api_test/cast_streaming/common.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/common.js
diff --git a/chrome/test/data/extensions/api_test/cast_streaming/common.js b/chrome/test/data/extensions/api_test/cast_streaming/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..36b6aec8287b2bb4ca13248486bc3366400b0bea
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/cast_streaming/common.js
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+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;
+ this.gotAudioRawEvents = false;
+ this.gotVideoRawEvents = 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();
+}
+
+TestStateMachine.prototype.onGotRawEvents = function(id, rawEvents) {
+ chrome.test.assertTrue(rawEvents.length > 0);
+ if (id == this.audioId) {
+ this.gotAudioRawEvents = true;
+ }
+ if (id == this.videoId) {
+ this.gotVideoRawEvents = true;
+ }
+ if (this.gotAudioRawEvents && this.gotVideoRawEvents)
+ this.onGotAllRawEvents();
+}
+

Powered by Google App Engine
This is Rietveld 408576698