2 Copyright 2013 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
12 window
.setUp = function() {
13 var doNothing = function() {};
14 var mockClientRenderer
= {
15 playerUpdated
: doNothing
,
16 playerRemoved
: doNothing
,
17 playerAdded
: doNothing
,
18 audioStreamUpdated
: doNothing
,
19 audioStreamAdded
: doNothing
,
20 audioStreamRemoved
: doNothing
23 var manager
= new Manager(mockClientRenderer
);
24 media
.initialize(manager
);
26 window
.manager
= manager
;
29 // The renderer and player ids are completely arbitrarily.
30 var TEST_RENDERER
= 12;
32 var TEST_NAME
= TEST_RENDERER
+ ':' + TEST_PLAYER
;
34 // Correctly use the information from a media event.
35 window
.testOnMediaEvent = function() {
38 renderer
: TEST_RENDERER
,
46 window
.media
.onMediaEvent(event
);
47 var info
= window
.manager
.players_
[TEST_NAME
];
49 assertEquals(event
.ticksMillis
, info
.firstTimestamp_
);
50 assertEquals(TEST_NAME
, info
.id
);
51 assertEquals(event
.params
.fps
, info
.properties
.fps
);
55 window
.testOnRenderTerminated = function() {
56 window
.testOnMediaEvent();
58 window
.media
.onRendererTerminated(TEST_RENDERER
);
59 assertEquals(undefined, window
.manager
.players_
[TEST_NAME
]);
62 // Audio Streams are weird, they are handled separately
63 window
.testAddAudioStream = function() {
70 window
.media
.addAudioStream(event
);
72 var player
= window
.manager
.audioStreams_
[event
.id
];
73 assertTrue(undefined !== player
);
74 assertEquals(event
.playing
, player
['playing']);