OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains various mock objects for the chrome platform to make | 5 // This file contains various mock objects for the chrome platform to make |
6 // unit testing easier. | 6 // unit testing easier. |
7 | 7 |
8 Entry = function() {}; | 8 Entry = function() {}; |
9 | 9 |
10 var chromeMocks = {}; | 10 var chromeMocks = {}; |
11 | 11 |
| 12 /** @constructor */ |
| 13 chrome.Event = function() {}; |
| 14 |
| 15 /** @param {Function} callback */ |
| 16 chrome.Event.prototype.addListener = function(callback) {}; |
| 17 |
| 18 /** @param {Function} callback */ |
| 19 chrome.Event.prototype.removeListener = function(callback) {}; |
| 20 |
| 21 |
12 (function(){ | 22 (function(){ |
13 | 23 |
14 /** | 24 /** |
15 * @constructor | 25 * @constructor |
16 */ | 26 */ |
17 chromeMocks.Event = function() { | 27 chromeMocks.Event = function() { |
18 this.listeners_ = []; | 28 this.listeners_ = []; |
19 }; | 29 }; |
20 | 30 |
21 /** @param {Function} callback */ | 31 /** @param {Function} callback */ |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if (!originals_) { | 196 if (!originals_) { |
187 throw new Error('You must call activate() before restore().'); | 197 throw new Error('You must call activate() before restore().'); |
188 } | 198 } |
189 for (var components in originals_) { | 199 for (var components in originals_) { |
190 chrome[components] = originals_[components]; | 200 chrome[components] = originals_[components]; |
191 } | 201 } |
192 originals_ = null; | 202 originals_ = null; |
193 }; | 203 }; |
194 | 204 |
195 })(); | 205 })(); |
OLD | NEW |