| 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..28a1ee8591a17eeff50cbdc342dffbef613bd05d
|
| --- /dev/null
|
| +++ b/chrome/test/data/webui/md_bookmarks/test_store.js
|
| @@ -0,0 +1,42 @@
|
| +// 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.actions_ = [];
|
| + this.observers_ = [];
|
| + };
|
| +
|
| + TestStore.prototype = {
|
| + addObserver: function(client) {
|
| + this.observers_.push(client);
|
| + },
|
| +
|
| + removeObserver: function(client) {},
|
| +
|
| + isInitialized: function() {
|
| + return true;
|
| + },
|
| +
|
| + handleAction: function(action) {
|
| + this.actions_.push(action);
|
| + },
|
| +
|
| + get lastAction() {
|
| + return this.actions_[this.actions_.length - 1];
|
| + },
|
| +
|
| + notifyObservers: function() {
|
| + // For simplicity, we don't want tests to have to worry about modifying
|
| + // the whole state tree when they want to change a single property. An
|
| + // alternative is to perform a deep clone in here.
|
| + this.observers_.forEach((client) => client.onStateChanged(this.data));
|
| + },
|
| + };
|
| +
|
| + return {
|
| + TestStore: TestStore,
|
| + };
|
| +});
|
|
|