Chromium Code Reviews| 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..a21aa294cc0ca63d5b5f2fb2700ccbae9bb94ff4 |
| --- /dev/null |
| +++ b/content/browser/resources/media/new/integration_test.html |
| @@ -0,0 +1,85 @@ |
| +<!-- |
| +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 (){}; |
|
scherkus (not reviewing)
2013/07/29 23:09:23
no space before (
add a space after )
var doNothi
|
| + 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); |
| + |
| + assertTrue(undefined !== window.playerManager.players_[event.id]); |
| + assertEquals(event.playing, window.playerManager.players_[event.id].properties['playing']) |
|
scherkus (not reviewing)
2013/07/29 23:09:23
fix 80 chars
|
| + }; |
| + |
| + runTests(); |
| + </script> |
| + </body> |
| +</html> |