blob: f738f6b0c5c579aaac86a9af02b8e9bb6e3c4a2b [file] [log] [blame]
<!--
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>
<body>
<script>
window.chrome = {};
var doNothing = function() {};
var emptyClientRenderer = {
playerAdded: doNothing,
playerRemoved: doNothing,
playerUpdated: doNothing
};
window.setUp = function() {
window.pm = new Manager(emptyClientRenderer);
};
window.tearDown = function() {
window.pm = null;
};
// Test a normal case of .addPlayer
window.testAddPlayer = function() {
window.pm.addPlayer('someid');
assertTrue(undefined !== window.pm.players_['someid']);
};
// On occasion, the backend will add an existing ID multiple times.
// make sure this doesn't break anything.
window.testAddPlayerAlreadyExisting = function() {
window.pm.addPlayer('someid');
window.pm.addPlayer('someid');
assertTrue(undefined !== window.pm.players_['someid']);
};
// If the removal is set, make sure that a player
// gets removed from the PlayerManager.
window.testRemovePlayer = function() {
window.pm.addPlayer('someid');
assertTrue(undefined !== window.pm.players_['someid']);
window.pm.removePlayer('someid');
assertTrue(undefined === window.pm.players_['someid']);
};
// Trying to select a non-existant player should throw
// an exception
window.testSelectNonExistant = function() {
assertThrows(function() {
window.pm.selectPlayer('someId');
});
};
</script>
</body>
</html>