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.
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() {
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
53 window
.testSelectNonExistant = function() {
54 assertThrows(function() {
55 window
.pm
.selectPlayer('someId');