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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('bookmarks', function() {
6 var TestStore = function(data) {
7 this.data = Object.assign(bookmarks.util.createEmptyState(), data);
8 this.lastAction_ = null;
9 this.observers_ = [];
10 };
11
12 TestStore.prototype = {
13 addObserver: function(client) {
14 this.observers_.push(client);
15 },
16
17 removeObserver: function(client) {},
18
19 isInitialized: function() {
20 return true;
21 },
22
23 handleAction: function(action) {
24 this.lastAction_ = action;
25 },
26
27 get lastAction() {
28 return this.lastAction_;
29 },
30
31 notifyObservers: function() {
32 // TODO(tsergeant): Revisit how state modifications work in UI tests.
33 // We don't want tests to worry about modifying the whole state tree.
34 // Instead, we could perform a deep clone in here to ensure that every
35 // StoreClient is updated.
36 this.observers_.forEach((client) => client.onStateChanged(this.data));
37 },
38 };
39
40 return {
41 TestStore: TestStore,
42 };
43 });
OLDNEW
« 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