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..36041011cdfa3a390ca3fcd4dbdf9e950413473c 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,12 @@ cr.define('bookmarks', function() { |
this.observers_.push(client); |
}, |
- init: function() {}, |
+ init: function(state) { |
+ if (this.acceptInit_) { |
+ this.data = state; |
+ this.acceptInit_ = false; |
+ } |
+ }, |
removeObserver: function(client) {}, |
@@ -37,6 +43,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 once. |
+ acceptInitOnce: function() { |
+ this.acceptInit_ = true; |
+ }, |
}; |
return { |