[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / test / data / media / webui / manager_test.html
blobf738f6b0c5c579aaac86a9af02b8e9bb6e3c4a2b
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 <body>
9 <script>
10 window.chrome = {};
12 var doNothing = function() {};
14 var emptyClientRenderer = {
15 playerAdded: doNothing,
16 playerRemoved: doNothing,
17 playerUpdated: doNothing
20 window.setUp = function() {
21 window.pm = new Manager(emptyClientRenderer);
24 window.tearDown = function() {
25 window.pm = null;
28 // Test a normal case of .addPlayer
29 window.testAddPlayer = function() {
30 window.pm.addPlayer('someid');
31 assertTrue(undefined !== window.pm.players_['someid']);
34 // On occasion, the backend will add an existing ID multiple times.
35 // make sure this doesn't break anything.
36 window.testAddPlayerAlreadyExisting = function() {
37 window.pm.addPlayer('someid');
38 window.pm.addPlayer('someid');
39 assertTrue(undefined !== window.pm.players_['someid']);
42 // If the removal is set, make sure that a player
43 // gets removed from the PlayerManager.
44 window.testRemovePlayer = function() {
45 window.pm.addPlayer('someid');
46 assertTrue(undefined !== window.pm.players_['someid']);
47 window.pm.removePlayer('someid');
48 assertTrue(undefined === window.pm.players_['someid']);
51 // Trying to select a non-existant player should throw
52 // an exception
53 window.testSelectNonExistant = function() {
54 assertThrows(function() {
55 window.pm.selectPlayer('someId');
56 });
58 </script>
59 </body>
60 </html>