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

Unified 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: Wraped util in a module Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/resources/media/new/main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/resources/media/new/integration_test.html
diff --git a/content/browser/resources/media/new/integration_test.html b/content/browser/resources/media/new/integration_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..3a5225cb64794dc6a3a101c4db0de4a5639ff600
--- /dev/null
+++ b/content/browser/resources/media/new/integration_test.html
@@ -0,0 +1,86 @@
+<!--
+Copyright 2013 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="webui_resource_test.js"></script>
+ <script src="util.js"></script>
+ <script src="player_manager.js"></script>
+ <script src="player_info.js"></script>
+ <script src="main.js"></script>
+ </head>
+ <body>
+ <script>
+ window.setUp = function() {
+ var doNothing = function() {};
+ var mockRenderer = {
+ redrawList: doNothing,
+ update: doNothing,
+ select: doNothing
+ };
+
+ var manager = new PlayerManager(mockRenderer);
+ media.initialize(manager);
+
+ window.playerManager = manager;
+ };
+
+ // The renderer and player ids are completely arbitrarily.
+ var TEST_RENDERER = 12;
+ var TEST_PLAYER = 4;
+ var TEST_NAME = TEST_RENDERER + ':' + TEST_PLAYER;
+
+ // Correctly use the information from a media event.
+ window.testOnMediaEvent = function() {
+ var event = {
+ ticksMillis: 132,
+ renderer: TEST_RENDERER,
+ player: TEST_PLAYER,
+ params: {
+ fps: 60,
+ other: 'hi'
+ }
+ };
+
+ window.media.onMediaEvent(event);
+ var info = window.playerManager.players_[TEST_NAME];
+
+ assertEquals(event.ticksMillis, info.firstTimestamp_);
+ assertEquals(TEST_NAME, info.id);
+ assertEquals(event.params.fps, info.properties.fps);
+ };
+
+ // Remove a player.
+ window.testOnRenderTerminated = function() {
+ window.testOnMediaEvent();
+
+ window.playerManager.shouldRemovePlayer_ = function() {
+ return true;
+ };
+
+ window.media.onRendererTerminated(TEST_RENDERER);
+ assertEquals(undefined, window.playerManager.players_[TEST_NAME]);
+ };
+
+ // Audio Streams are weird, they are handled separately
+ window.testAddAudioStream = function() {
+ var event = {
+ id: 'ID',
+ status: 'created',
+ playing: true
+ };
+
+ window.media.addAudioStream(event);
+
+ var player = window.playerManager.players_[event.id];
+ assertTrue(undefined !== player);
+ assertEquals(event.playing, player.properties['playing']);
+ };
+
+ runTests();
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | content/browser/resources/media/new/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698