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

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: Fixed style issues, slightly modified how the media singleton is tested" 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
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..8f140917bf57ae294a0f217720059a7e4bb967e1
--- /dev/null
+++ b/content/browser/resources/media/new/integration_test.html
@@ -0,0 +1,76 @@
+<!--
+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="goog.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() {
+ media.refreshManagerForTest();
+ window.pm = media.getManager();
scherkus (not reviewing) 2013/07/29 22:16:28 s/pm/somethingWayMoreDescriptive/ for example ...
Ty Overby 2013/07/29 22:47:22 Done.
+ };
+
+ // The renderer and player ids are completely arbitrarily
scherkus (not reviewing) 2013/07/29 22:16:28 periods!
Ty Overby 2013/07/29 22:47:22 Done.
+ 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,
scherkus (not reviewing) 2013/07/29 22:16:28 this block should be de-indented by two spaces th
Ty Overby 2013/07/29 22:47:22 Done.
+ renderer: TEST_RENDERER,
+ player: TEST_PLAYER,
+ params: {
+ fps: 60,
+ other: 'hi'
+ }
+ };
+
+ window.media.onMediaEvent(event);
+ var info = window.pm.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.pm.shouldRemovePlayer_ = function() {
+ return true;
+ };
+
+ window.media.onRendererTerminated(TEST_RENDERER);
+ assertEquals(undefined, pm.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);
+
+ assertTrue(undefined !== pm.players_[event.id]);
+ assertEquals(event.playing, pm.players_[event.id].properties['playing'])
+ };
+
+ runTests();
+ </script>
+ </body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698