diff options
author | kelvinp <kelvinp@chromium.org> | 2015-11-10 11:26:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-10 19:27:52 +0000 |
commit | cb61f37e5f706260e86e7e95e91596408cf78e9c (patch) | |
tree | 737bf7db932752e35b43c3ce8e5e5ed8642a9d40 /remoting | |
parent | b016a6d295ea3789a3a24002ef1fb9c2bd395c76 (diff) | |
download | chromium_src-cb61f37e5f706260e86e7e95e91596408cf78e9c.zip chromium_src-cb61f37e5f706260e86e7e95e91596408cf78e9c.tar.gz chromium_src-cb61f37e5f706260e86e7e95e91596408cf78e9c.tar.bz2 |
[Chromoting] Fix telemetry error in remoting.It2MeActivity
1. Excludes the access code entry time from the session duration.
2. Reports cancellation/error to the telemetry service if the
main promise in It2meActivity.start() rejects.
3. Disposes DesktopRemotingActivity if the session fails to connect.
BUG=549658
Review URL: https://codereview.chromium.org/1413923015
Cr-Commit-Position: refs/heads/master@{#358874}
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/webapp/crd/js/it2me_activity.js | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/remoting/webapp/crd/js/it2me_activity.js b/remoting/webapp/crd/js/it2me_activity.js index c05d219..1e69c63 100644 --- a/remoting/webapp/crd/js/it2me_activity.js +++ b/remoting/webapp/crd/js/it2me_activity.js @@ -46,28 +46,41 @@ remoting.It2MeActivity.prototype.dispose = function() { remoting.It2MeActivity.prototype.start = function() { var that = this; + var SessionState = remoting.ChromotingEvent.SessionState; this.logger_ = this.createLogger_(); - this.logger_.logSessionStateChange( - remoting.ChromotingEvent.SessionState.STARTED); + this.logger_.logSessionStateChange(SessionState.STARTED); + console.assert( + !this.desktopActivity_, 'Zombie DesktopActivity from previous session'); + base.dispose(this.desktopActivity_); this.desktopActivity_ = new remoting.DesktopRemotingActivity(this, this.logger_); + function onError(/** remoting.Error */ error) { + if (error.isCancel()) { + that.logger_.logSessionStateChange(SessionState.CONNECTION_CANCELED); + remoting.setMode(remoting.AppMode.HOME); + } else { + that.logger_.logSessionStateChange(SessionState.CONNECTION_FAILED, error); + that.showErrorMessage_(error); + } + + base.dispose(that.desktopActivity_); + that.desktopActivity_ = null; + } + + var sessionStart = Date.now(); + this.accessCodeDialog_.show().then(function(/** string */ accessCode) { + that.logger_.setAuthTotalTime(Date.now() - sessionStart); that.desktopActivity_.getConnectingDialog().show(); return that.verifyAccessCode_(accessCode); }).then(function() { return remoting.HostListApi.getInstance().getSupportHost(that.hostId_); }).then(function(/** remoting.Host */ host) { that.connect_(host); - }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { - if (error.hasTag(remoting.Error.Tag.CANCELLED)) { - remoting.setMode(remoting.AppMode.HOME); - } else { - that.showErrorMessage_(error); - } - })); + }).catch(remoting.Error.handler(onError)); }; |