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

Side by Side Diff: content/browser/resources/media/new/integration_test.html

Issue 20804002: Added the next series of files that go into media-internals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
(Empty)
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 <head>
9 <script src="webui_resource_test.js"></script>
10 <script src="util.js"></script>
11 <script src="player_manager.js"></script>
12 <script src="player_info.js"></script>
13 <script src="main.js"></script>
14 </head>
15 <body>
16 <script>
17 window.setUp = function() {
18 var doNothing = function(){};
scherkus (not reviewing) 2013/07/29 23:55:18 still missing a space between ) and {
Ty Overby 2013/07/30 00:13:34 Done.
19 var mockRenderer = {
20 redrawList: doNothing,
21 update: doNothing,
22 select: doNothing
23 };
24
25 var manager = new PlayerManager(mockRenderer);
26 media.initialize(manager);
27
28 window.playerManager = manager;
29 };
30
31 // The renderer and player ids are completely arbitrarily.
32 var TEST_RENDERER = 12;
33 var TEST_PLAYER = 4;
34 var TEST_NAME = TEST_RENDERER + ':' + TEST_PLAYER;
35
36 // Correctly use the information from a media event.
37 window.testOnMediaEvent = function() {
38 var event = {
39 ticksMillis: 132,
40 renderer: TEST_RENDERER,
41 player: TEST_PLAYER,
42 params: {
43 fps: 60,
44 other: 'hi'
45 }
46 };
47
48 window.media.onMediaEvent(event);
49 var info = window.playerManager.players_[TEST_NAME];
50
51 assertEquals(event.ticksMillis, info.firstTimestamp_);
52 assertEquals(TEST_NAME, info.id);
53 assertEquals(event.params.fps, info.properties.fps);
54 };
55
56 // Remove a player.
57 window.testOnRenderTerminated = function() {
58 window.testOnMediaEvent();
59
60 window.playerManager.shouldRemovePlayer_ = function() {
61 return true;
62 };
63
64 window.media.onRendererTerminated(TEST_RENDERER);
65 assertEquals(undefined, window.playerManager.players_[TEST_NAME]);
66 };
67
68 // Audio Streams are weird, they are handled separately
69 window.testAddAudioStream = function() {
70 var event = {
71 id: 'ID',
72 status: 'created',
73 playing: true
74 };
75
76 window.media.addAudioStream(event);
77
78 var player = window.playerManager.players_[event.id];
scherkus (not reviewing) 2013/07/29 23:55:18 if you're going to define a local variable to fix
Ty Overby 2013/07/30 00:13:34 Done.
79
80 assertTrue(undefined !== window.playerManager.players_[event.id]);
81 assertEquals(event.playing, player.properties['playing']);
82 };
83
84 runTests();
85 </script>
86 </body>
87 </html>
OLDNEW
« no previous file with comments | « no previous file | content/browser/resources/media/new/main.js » ('j') | content/browser/resources/media/new/main.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698