| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 suiteSetup(function() { | 5 suiteSetup(function() { |
| 6 cr.define('bookmarks', function() { | 6 cr.define('bookmarks', function() { |
| 7 var TestStore = function(data) { | 7 var TestStore = function(data) { |
| 8 bookmarks.Store.call(this); | 8 bookmarks.Store.call(this); |
| 9 this.data_ = Object.assign(bookmarks.util.createEmptyState(), data); | 9 this.data_ = Object.assign(bookmarks.util.createEmptyState(), data); |
| 10 this.initialized_ = true; | 10 this.initialized_ = true; |
| 11 | 11 |
| 12 this.lastAction_ = null; | 12 this.lastAction_ = null; |
| 13 this.acceptInit_ = false; | 13 this.acceptInit_ = false; |
| 14 this.enableReducers_ = false; | 14 this.enableReducers_ = false; |
| 15 }; | 15 }; |
| 16 | 16 |
| 17 TestStore.prototype = { | 17 TestStore.prototype = { |
| 18 __proto__: bookmarks.Store.prototype, | 18 __proto__: bookmarks.Store.prototype, |
| 19 | 19 |
| 20 init: function(state) { | 20 init: function(state) { |
| 21 if (this.acceptInit_) | 21 if (this.acceptInit_) |
| 22 bookmarks.Store.prototype.init.call(this, state); | 22 bookmarks.Store.prototype.init.call(this, state); |
| 23 }, | 23 }, |
| 24 | 24 |
| 25 get lastAction() { | 25 get lastAction() { |
| 26 return this.lastAction_; | 26 return this.lastAction_; |
| 27 }, | 27 }, |
| 28 | 28 |
| 29 resetLastAction() { |
| 30 this.lastAction_ = null; |
| 31 }, |
| 32 |
| 29 get data() { | 33 get data() { |
| 30 return this.data_; | 34 return this.data_; |
| 31 }, | 35 }, |
| 32 | 36 |
| 33 set data(newData) { | 37 set data(newData) { |
| 34 this.data_ = newData; | 38 this.data_ = newData; |
| 35 }, | 39 }, |
| 36 | 40 |
| 37 /** | 41 /** |
| 38 * Enable or disable calling bookmarks.reduceAction for each action. | 42 * Enable or disable calling bookmarks.reduceAction for each action. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 this.acceptInit_ = true; | 71 this.acceptInit_ = true; |
| 68 this.initialized_ = false; | 72 this.initialized_ = false; |
| 69 }, | 73 }, |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 return { | 76 return { |
| 73 TestStore: TestStore, | 77 TestStore: TestStore, |
| 74 }; | 78 }; |
| 75 }); | 79 }); |
| 76 }); | 80 }); |
| OLD | NEW |