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

Side by Side Diff: chrome/test/data/extensions/api_test/cast_streaming/common.js

Issue 184853003: Cast: Add GetStats() extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static cast to int Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function TestStateMachine(stream, audioId, videoId, udpId) { 5 function TestStateMachine(stream, audioId, videoId, udpId) {
6 this.stream = stream; 6 this.stream = stream;
7 this.audioId = audioId; 7 this.audioId = audioId;
8 this.videoId = videoId; 8 this.videoId = videoId;
9 this.udpId = udpId; 9 this.udpId = udpId;
10 this.audioStarted = false; 10 this.audioStarted = false;
11 this.videoStarted = false; 11 this.videoStarted = false;
12 this.audioStopped = false; 12 this.audioStopped = false;
13 this.videoStopped = false; 13 this.videoStopped = false;
14 this.gotAudioRawEvents = false; 14 this.gotAudioLogs = false;
15 this.gotVideoRawEvents = false; 15 this.gotVideoLogs = false;
16 } 16 }
17 17
18 TestStateMachine.prototype.onStarted = function(id) { 18 TestStateMachine.prototype.onStarted = function(id) {
19 if (id == this.audioId) 19 if (id == this.audioId)
20 this.audioStarted = true; 20 this.audioStarted = true;
21 if (id == this.videoId) 21 if (id == this.videoId)
22 this.videoStarted = true; 22 this.videoStarted = true;
23 if (this.audioStarted && this.videoStarted) 23 if (this.audioStarted && this.videoStarted)
24 this.onAllStarted(); 24 this.onAllStarted();
25 } 25 }
26 26
27 TestStateMachine.prototype.onStopped = function(id) { 27 TestStateMachine.prototype.onStopped = function(id) {
28 if (id == this.audioId) 28 if (id == this.audioId)
29 this.audioStopped = true; 29 this.audioStopped = true;
30 if (id == this.videoId) 30 if (id == this.videoId)
31 this.videoStopped = true; 31 this.videoStopped = true;
32 if (this.audioStopped && this.videoStopped) 32 if (this.audioStopped && this.videoStopped)
33 this.onAllStopped(); 33 this.onAllStopped();
34 } 34 }
35 35
36 TestStateMachine.prototype.onGotRawEvents = function(id, rawEvents) { 36 TestStateMachine.prototype.onGotLogs = function(id, data) {
37 chrome.test.assertTrue(rawEvents.length > 0); 37 chrome.test.assertTrue(!!data);
38 if (id == this.audioId) { 38 if (id == this.audioId)
39 this.gotAudioRawEvents = true; 39 this.gotAudioLogs = true;
40 } 40 if (id == this.videoId)
41 if (id == this.videoId) { 41 this.gotVideoLogs = true;
42 this.gotVideoRawEvents = true; 42 if (this.gotAudioLogs && this.gotVideoLogs)
43 } 43 this.onGotAllLogs();
44 if (this.gotAudioRawEvents && this.gotVideoRawEvents)
45 this.onGotAllRawEvents();
46 } 44 }
47 45
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698