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

Side by Side Diff: content/test/data/media/webui/integration_test.html

Issue 68173025: Introduce new interface for MediaInternals updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix JavaScript test. Use non-exported base. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/resources/media/media_internals.html ('k') | media/audio/audio_logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 Copyright 2013 The Chromium Authors. All rights reserved. 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 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 <!DOCTYPE html> 6 <!DOCTYPE html>
7 <html> 7 <html>
8 <body> 8 <body>
9 <script> 9 <script>
10 window.chrome = {}; 10 window.chrome = {};
11 11
12 window.setUp = function() { 12 window.setUp = function() {
13 var doNothing = function() {}; 13 var doNothing = function() {};
14 var mockClientRenderer = { 14 var mockClientRenderer = {
15 playerUpdated: doNothing, 15 playerUpdated: doNothing,
16 playerRemoved: doNothing, 16 playerRemoved: doNothing,
17 playerAdded: doNothing, 17 playerAdded: doNothing,
18 audioStreamUpdated: doNothing, 18 audioComponentAdded: doNothing,
19 audioStreamAdded: doNothing, 19 audioComponentRemoved: doNothing
20 audioStreamRemoved: doNothing
21 }; 20 };
22 21
23 var manager = new Manager(mockClientRenderer); 22 var manager = new Manager(mockClientRenderer);
24 media.initialize(manager); 23 media.initialize(manager);
25 24
26 window.manager= manager; 25 window.manager = manager;
27 }; 26 };
28 27
29 // The renderer and player ids are completely arbitrarily. 28 // The renderer and player ids are completely arbitrarily.
30 var TEST_RENDERER = 12; 29 var TEST_RENDERER = 12;
31 var TEST_PLAYER = 4; 30 var TEST_PLAYER = 4;
32 var TEST_NAME = TEST_RENDERER + ':' + TEST_PLAYER; 31 var TEST_NAME = TEST_RENDERER + ':' + TEST_PLAYER;
33 32
34 // Correctly use the information from a media event. 33 // Correctly use the information from a media event.
35 window.testOnMediaEvent = function() { 34 window.testOnMediaEvent = function() {
36 var event = { 35 var event = {
(...skipping 15 matching lines...) Expand all
52 }; 51 };
53 52
54 // Remove a player. 53 // Remove a player.
55 window.testOnRenderTerminated = function() { 54 window.testOnRenderTerminated = function() {
56 window.testOnMediaEvent(); 55 window.testOnMediaEvent();
57 56
58 window.media.onRendererTerminated(TEST_RENDERER); 57 window.media.onRendererTerminated(TEST_RENDERER);
59 assertEquals(undefined, window.manager.players_[TEST_NAME]); 58 assertEquals(undefined, window.manager.players_[TEST_NAME]);
60 }; 59 };
61 60
62 // Audio Streams are weird, they are handled separately 61 window.testAudioComponents = function() {
63 window.testAddAudioStream = function() {
64 var event = { 62 var event = {
65 id: 'ID', 63 component_id: 1,
66 status: 'created', 64 component_type: 0,
67 playing: true 65 owner_id: 3,
66 status: 'created'
68 }; 67 };
69 68
70 window.media.addAudioStream(event); 69 // Ensure no components are currently present.
70 assertEquals(0, window.manager.audioComponents_.length);
71 71
72 var player = window.manager.audioStreams_[event.id]; 72 // Test adding an audio component.
73 assertTrue(undefined !== player); 73 window.media.updateAudioComponent(event);
74 assertEquals(event.playing, player['playing']); 74 assertEquals(1, window.manager.audioComponents_.length);
75
76 // The key format is an implementation detail we don't care about, so
77 // just ensure there's only one key and then use it directly.
78 assertEquals(1, Object.keys(
79 window.manager.audioComponents_[event.component_type]).length);
80 for (key in window.manager.audioComponents_[event.component_type]) {
81 var component =
82 window.manager.audioComponents_[event.component_type][key];
83 assertEquals(event.component_id, component['component_id']);
84 assertEquals(event.component_type, component['component_type']);
85 assertEquals(event.owner_id, component['owner_id']);
86 assertEquals(event.status, component['status']);
87 }
88
89 // Test removing an audio component.
90 event.status = 'closed';
91 window.media.updateAudioComponent(event);
92 assertEquals(1, window.manager.audioComponents_.length);
93 assertEquals(0, Object.keys(
94 window.manager.audioComponents_[event.component_type]).length);
75 }; 95 };
76 </script> 96 </script>
77 </body> 97 </body>
78 </html> 98 </html>
OLDNEW
« no previous file with comments | « content/browser/resources/media/media_internals.html ('k') | media/audio/audio_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698