OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * Creates and returns a CommandManager which tracks what commands are executed. | |
7 * @constructor | |
8 * @extends {bookmarks.CommandManager} | |
9 */ | |
10 function TestCommandManager() { | |
11 var commandManager = document.createElement('bookmarks-command-manager'); | |
12 var lastCommand = null; | |
13 var lastCommandIds = null; | |
14 | |
15 var realHandle = commandManager.handle.bind(commandManager); | |
16 commandManager.handle = function(command, itemIds) { | |
17 lastCommand = command; | |
18 lastCommandIds = itemIds; | |
19 realHandle(command, itemIds); | |
20 }; | |
21 | |
22 commandManager.assertLastCommand = function (command, ids) { | |
23 assertEquals(lastCommand, command); | |
24 if (ids) | |
25 assertDeepEquals(normalizeSet(lastCommandIds), ids); | |
calamity
2017/05/23 05:46:03
nit: Flip the assert args here and above.
tsergeant
2017/05/23 06:50:42
Done.
| |
26 lastCommand = null; | |
27 lastCommandIds = null; | |
28 }; | |
29 | |
30 return commandManager; | |
31 } | |
OLD | NEW |