Get foreground tab on Android
[chromium-blink-merge.git] / content / test / data / media / webui / integration_test.html
blobbe567a0f1cc4411a6bcb588a4e63981dd667d238
1 <!--
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.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <body>
9 <script>
10 window.chrome = {};
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;
31 var TEST_PLAYER = 4;
32 var TEST_NAME = TEST_RENDERER + ':' + TEST_PLAYER;
34 // Correctly use the information from a media event.
35 window.testOnMediaEvent = function() {
36 var event = {
37 ticksMillis: 132,
38 renderer: TEST_RENDERER,
39 player: TEST_PLAYER,
40 params: {
41 fps: 60,
42 other: 'hi'
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);
54 // Remove a player.
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() {
64 var event = {
65 id: 'ID',
66 status: 'created',
67 playing: true
70 window.media.addAudioStream(event);
72 var player = window.manager.audioStreams_[event.id];
73 assertTrue(undefined !== player);
74 assertEquals(event.playing, player['playing']);
76 </script>
77 </body>
78 </html>