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

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

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: calamity@ review 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
new file mode 100644
index 0000000000000000000000000000000000000000..0dd9791930bb61b47fe66627b542f9f31935481e
--- /dev/null
+++ b/chrome/test/data/webui/md_bookmarks/test_store.js
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('bookmarks', function() {
+ var TestStore = function(data) {
+ this.data = Object.assign(bookmarks.util.createEmptyState(), data);
+ this.lastAction_ = null;
+ this.observers_ = [];
+ };
+
+ TestStore.prototype = {
+ addObserver: function(client) {
+ this.observers_.push(client);
+ },
+
+ removeObserver: function(client) {},
+
+ isInitialized: function() {
+ return true;
+ },
+
+ handleAction: function(action) {
+ this.lastAction_ = action;
+ },
+
+ get lastAction() {
+ return this.lastAction_;
+ },
+
+ notifyObservers: function() {
+ // TODO(tsergeant): Revisit how state modifications work in UI tests.
+ // We don't want tests to worry about modifying the whole state tree.
+ // Instead, we could perform a deep clone in here to ensure that every
+ // StoreClient is updated.
+ this.observers_.forEach((client) => client.onStateChanged(this.data));
+ },
+ };
+
+ return {
+ TestStore: TestStore,
+ };
+});
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/sidebar_test.js ('k') | chrome/test/data/webui/md_bookmarks/test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698