Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1775)

Unified Diff: chrome/test/data/webui/md_bookmarks/test_util.js

Issue 2893833002: MD Bookmarks: Enable the delete button in the toolbar overlay (Closed)
Patch Set: Add a test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
+}

Powered by Google App Engine
This is Rietveld 408576698