Index: chrome/test/data/webui/md_bookmarks/test_util.js |
diff --git a/chrome/test/data/webui/md_bookmarks/test_util.js b/chrome/test/data/webui/md_bookmarks/test_util.js |
index c1b2279b0f42a50f4cbf12f7ab6eb9eede16ba14..de5142d2ddb1270c5f605b04f71612b8f4fa11fc 100644 |
--- a/chrome/test/data/webui/md_bookmarks/test_util.js |
+++ b/chrome/test/data/webui/md_bookmarks/test_util.js |
@@ -136,3 +136,31 @@ function findFolderNode(rootNode, id) { |
.forEach((x) => {nodes.unshift(x)}); |
} |
} |
+ |
+/** |
+ * Creates and returns a CommandManager which tracks what commands are executed. |
+ * @constructor |
+ * @extends {bookmarks.CommandManager} |
+ */ |
+function TestCommandManager() { |
calamity
2017/05/23 03:42:55
Yeah, probably best to have this pulled out a la T
tsergeant
2017/05/23 04:11:36
Done.
|
+ var commandManager = document.createElement('bookmarks-command-manager'); |
+ var lastCommand = null; |
+ var lastCommandIds = null; |
+ |
+ var realHandle = commandManager.handle.bind(commandManager); |
+ commandManager.handle = function(command, itemIds) { |
+ lastCommand = command; |
+ lastCommandIds = itemIds; |
+ realHandle(command, itemIds); |
+ }; |
+ |
+ commandManager.assertLastCommand = function (command, ids) { |
+ assertEquals(lastCommand, command); |
+ if (ids) |
+ assertDeepEquals(normalizeSet(lastCommandIds), ids); |
+ lastCommand = null; |
+ lastCommandIds = null; |
+ }; |
+ |
+ return commandManager; |
+} |