Index: remoting/webapp/js_proto/chrome_mocks.js |
diff --git a/remoting/webapp/js_proto/chrome_mocks.js b/remoting/webapp/js_proto/chrome_mocks.js |
index a1e449090dc9215314166dffe10c3374125380aa..ffc7f6eab2c7bdbdfee21417128db29925ca4795 100644 |
--- a/remoting/webapp/js_proto/chrome_mocks.js |
+++ b/remoting/webapp/js_proto/chrome_mocks.js |
@@ -103,8 +103,11 @@ chromeMocks.runtime.sendMessage = function(extensionId, message, |
/** @type {string} */ |
chromeMocks.runtime.id = 'extensionId'; |
-/** @type {Object} */ |
-chromeMocks.storage = {}; |
+chromeMocks.runtime.lastError = { |
+ /** @type {string|undefined} */ |
+ message: undefined |
+}; |
+ |
// Sample implementation of chrome.StorageArea according to |
// https://developer.chrome.com/apps/storage#type-StorageArea |
@@ -170,9 +173,37 @@ chromeMocks.StorageArea.prototype.clear = function() { |
this.storage_ = null; |
}; |
+/** @type {Object} */ |
+chromeMocks.storage = {}; |
+ |
/** @type {chromeMocks.StorageArea} */ |
chromeMocks.storage.local = new chromeMocks.StorageArea(); |
+ |
+/** @constructor */ |
+chromeMocks.Identity = function() { |
+ /** @private {string|undefined} */ |
+ this.token_ = undefined; |
+}; |
+ |
+chromeMocks.Identity.prototype.getAuthToken = function(options, callback) { |
+ // Don't use setTimeout because sinon mocks it. |
+ window.requestAnimationFrame(callback.bind(null, this.token_)); |
+}; |
+ |
+/** @param {string} token */ |
+chromeMocks.Identity.prototype.mock$setToken = function(token) { |
+ this.token_ = token; |
+}; |
+ |
+chromeMocks.Identity.prototype.mock$clearToken = function() { |
+ this.token_ = undefined; |
+}; |
+ |
+/** @type {chromeMocks.Identity} */ |
+chromeMocks.identity = new chromeMocks.Identity(); |
+ |
+ |
var originals_ = null; |
/** |