summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/js_proto
diff options
context:
space:
mode:
authorkelvinp <kelvinp@chromium.org>2015-06-25 14:31:29 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-25 21:32:00 +0000
commitf2c15c3f1adebd9a171f849fc7ec15e3f4b165e8 (patch)
tree730e84980b14ca226e1ad8a4029aab189d831868 /remoting/webapp/js_proto
parent765381052c1fdda85f934ba24722463347c472b6 (diff)
downloadchromium_src-f2c15c3f1adebd9a171f849fc7ec15e3f4b165e8.zip
chromium_src-f2c15c3f1adebd9a171f849fc7ec15e3f4b165e8.tar.gz
chromium_src-f2c15c3f1adebd9a171f849fc7ec15e3f4b165e8.tar.bz2
[Chromoting] Implements remoting.TelemetryEventWriter
This change implements remoting.TelemetryEventWriter. The TelemetryEventWriter has two components: a) a Service that runs in the background page b) Client static methods that can be called from any page. When a session starts, the client calls Client.startSession(windowId, sessionId). Internally, the service will keep track of a mapping from window id to ongoing sessions. In this way, if a session is dropped (the user closes the window via the system context menu) unexpectedly, the Service can detect that and automatically log the session close event. BUG=497268 Review URL: https://codereview.chromium.org/1203793002 Cr-Commit-Position: refs/heads/master@{#336257}
Diffstat (limited to 'remoting/webapp/js_proto')
-rw-r--r--remoting/webapp/js_proto/chrome_mocks.js18
-rw-r--r--remoting/webapp/js_proto/sinon_proto.js8
2 files changed, 24 insertions, 2 deletions
diff --git a/remoting/webapp/js_proto/chrome_mocks.js b/remoting/webapp/js_proto/chrome_mocks.js
index af4c178..5069b73 100644
--- a/remoting/webapp/js_proto/chrome_mocks.js
+++ b/remoting/webapp/js_proto/chrome_mocks.js
@@ -76,6 +76,10 @@ chromeMocks.runtime.Port.prototype.postMessage = function(message) {};
/** @type {chromeMocks.Event} */
chromeMocks.runtime.onMessage = new chromeMocks.Event();
+
+/** @type {chromeMocks.Event} */
+chromeMocks.runtime.onSuspend = new chromeMocks.Event();
+
/**
* @param {string?} extensionId
* @param {*} message
@@ -121,6 +125,14 @@ chromeMocks.runtime.lastError = {
message: undefined
};
+chromeMocks.runtime.getManifest = function() {
+ return {
+ version: 10,
+ app: {
+ background: true
+ }
+ };
+};
// Sample implementation of chrome.StorageArea according to
// https://developer.chrome.com/apps/storage#type-StorageArea
@@ -251,10 +263,12 @@ chromeMocks.I18n.prototype.getMessage = function(messageName, opt_args) {};
chromeMocks.I18n.prototype.getUILanguage = function() {};
/** @constructor */
-chromeMocks.WindowManager = function() {};
+chromeMocks.WindowManager = function() {
+ this.current_ = new chromeMocks.AppWindow();
+};
chromeMocks.WindowManager.prototype.current = function() {
- return new chromeMocks.AppWindow();
+ return this.current_;
};
/** @constructor */
diff --git a/remoting/webapp/js_proto/sinon_proto.js b/remoting/webapp/js_proto/sinon_proto.js
index 8641a82..e24bd31 100644
--- a/remoting/webapp/js_proto/sinon_proto.js
+++ b/remoting/webapp/js_proto/sinon_proto.js
@@ -34,6 +34,9 @@ sinon.Expectation = function() {};
/** @return {sinon.Expectation} */
sinon.Expectation.prototype.once = function() {};
+/** @return {sinon.Expectation} */
+sinon.Expectation.prototype.never = function() {};
+
/**
* @param {...} data
* @return {sinon.Expectation}
@@ -66,6 +69,11 @@ sinon.Mock.prototype.expects = function(method) {};
*/
sinon.Mock.prototype.restore = function() {};
+/**
+ * @return {boolean}
+ */
+sinon.Mock.prototype.verify = function() {};
+
/** @type {function(...):Function} */
sinon.spy = function() {};