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

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

Issue 2776993002: [MD Bookmarks] Persist collapsed folders between page loads. (Closed)
Patch Set: address comments, add test Created 3 years, 9 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_store.js
diff --git a/chrome/test/data/webui/md_bookmarks/test_store.js b/chrome/test/data/webui/md_bookmarks/test_store.js
index 77f5c0fee158a3f7cc0d891cd294c15a5e833e7d..e99f3896c4eab0b4bc108c16c72d7f6a1d9015db 100644
--- a/chrome/test/data/webui/md_bookmarks/test_store.js
+++ b/chrome/test/data/webui/md_bookmarks/test_store.js
@@ -7,6 +7,7 @@ cr.define('bookmarks', function() {
this.data = Object.assign(bookmarks.util.createEmptyState(), data);
this.lastAction_ = null;
this.observers_ = [];
+ this.acceptInit_ = false;
};
TestStore.prototype = {
@@ -14,7 +15,10 @@ cr.define('bookmarks', function() {
this.observers_.push(client);
},
- init: function() {},
+ init: function(state) {
+ if (this.acceptInit_)
+ this.data = state;
+ },
removeObserver: function(client) {},
@@ -37,6 +41,11 @@ cr.define('bookmarks', function() {
// StoreClient is updated.
this.observers_.forEach((client) => client.onStateChanged(this.data));
},
+
+ // Call in order to accept data from an init call to the TestStore.
+ acceptInit: function() {
+ this.acceptInit_ = true;
+ },
};
return {

Powered by Google App Engine
This is Rietveld 408576698