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 var chromeMocks = {}; | 8 var chromeMocks = {}; |
9 | 9 |
10 (function(){ | 10 (function(){ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 chromeMocks.runtime.Port.prototype.disconnect = function() {}; | 69 chromeMocks.runtime.Port.prototype.disconnect = function() {}; |
70 | 70 |
71 /** | 71 /** |
72 * @param {Object} message | 72 * @param {Object} message |
73 */ | 73 */ |
74 chromeMocks.runtime.Port.prototype.postMessage = function(message) {}; | 74 chromeMocks.runtime.Port.prototype.postMessage = function(message) {}; |
75 | 75 |
76 /** @type {chromeMocks.Event} */ | 76 /** @type {chromeMocks.Event} */ |
77 chromeMocks.runtime.onMessage = new chromeMocks.Event(); | 77 chromeMocks.runtime.onMessage = new chromeMocks.Event(); |
78 | 78 |
| 79 /** @type {chromeMocks.Event} */ |
| 80 chromeMocks.runtime.onMessageExternal = new chromeMocks.Event(); |
79 | 81 |
80 /** @type {chromeMocks.Event} */ | 82 /** @type {chromeMocks.Event} */ |
81 chromeMocks.runtime.onSuspend = new chromeMocks.Event(); | 83 chromeMocks.runtime.onSuspend = new chromeMocks.Event(); |
82 | 84 |
83 /** | 85 /** |
84 * @param {string?} extensionId | 86 * @param {string?} extensionId |
85 * @param {*} message | 87 * @param {*} message |
86 * @param {function(*)=} responseCallback | 88 * @param {function(*)=} responseCallback |
87 */ | 89 */ |
88 chromeMocks.runtime.sendMessage = function(extensionId, message, | 90 chromeMocks.runtime.sendMessage = function(extensionId, message, |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 throw new Error('You must call activate() before restore().'); | 321 throw new Error('You must call activate() before restore().'); |
320 } | 322 } |
321 for (var components in originals_) { | 323 for (var components in originals_) { |
322 chrome[components] = originals_[components]; | 324 chrome[components] = originals_[components]; |
323 } | 325 } |
324 originals_ = null; | 326 originals_ = null; |
325 nativePorts = null; | 327 nativePorts = null; |
326 }; | 328 }; |
327 | 329 |
328 })(); | 330 })(); |
OLD | NEW |