diff options
author | nicholss <nicholss@chromium.org> | 2015-09-29 11:06:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-29 18:08:58 +0000 |
commit | 284d97f05d577fd3b5b1fc7115368a7b1d292e10 (patch) | |
tree | 898e1c47c17ccbd1bcd0bbea98ae01571d92ad31 | |
parent | 20e1ede5e6eb73dac71b026a8d76da195048145a (diff) | |
download | chromium_src-284d97f05d577fd3b5b1fc7115368a7b1d292e10.zip chromium_src-284d97f05d577fd3b5b1fc7115368a7b1d292e10.tar.gz chromium_src-284d97f05d577fd3b5b1fc7115368a7b1d292e10.tar.bz2 |
Chrome Remote Desktop client integration for host OS details.
This will add the first pass integration for the client to have an
understanding of what kind of host OS and what the host OS version it will be
connecting to. There is also a minor update to the client side test runner to
add an optional parameter (--build-path) to allow each testing for the newer
style of gn builds that want to target the out/Default directory. Build path
defaults to "out/Debug" as before, but it is now overridable to a new target.
R=kelvinp@chromium.org
BUG=534902
Review URL: https://codereview.chromium.org/1373913002
Cr-Commit-Position: refs/heads/master@{#351352}
-rwxr-xr-x | remoting/tools/run_webapp_unittests.py | 25 | ||||
-rw-r--r-- | remoting/webapp/base/js/chromoting_event.js | 33 | ||||
-rw-r--r-- | remoting/webapp/base/js/host.js | 4 | ||||
-rw-r--r-- | remoting/webapp/base/js/log_to_server.js | 20 | ||||
-rw-r--r-- | remoting/webapp/base/js/logger.js | 15 | ||||
-rw-r--r-- | remoting/webapp/base/js/server_log_entry.js | 17 | ||||
-rw-r--r-- | remoting/webapp/base/js/session_logger.js | 18 | ||||
-rw-r--r-- | remoting/webapp/base/js/session_logger_unittest.js | 28 | ||||
-rw-r--r-- | remoting/webapp/base/js/telemetry_event_writer_unittest.js | 14 | ||||
-rw-r--r-- | remoting/webapp/crd/js/gcd_host_list_api.js | 3 | ||||
-rw-r--r-- | remoting/webapp/crd/js/legacy_host_list_api.js | 3 | ||||
-rw-r--r-- | remoting/webapp/crd/js/me2me_activity.js | 2 | ||||
-rw-r--r-- | remoting/webapp/files.gni | 3 |
13 files changed, 165 insertions, 20 deletions
diff --git a/remoting/tools/run_webapp_unittests.py b/remoting/tools/run_webapp_unittests.py index bff7128..e9cfada 100755 --- a/remoting/tools/run_webapp_unittests.py +++ b/remoting/tools/run_webapp_unittests.py @@ -27,12 +27,12 @@ def GetChromePath(): return chrome_path -def BuildTestPageUri(opt_module=None, opt_coverage=False): +def BuildTestPageUri(build_path, opt_module=None, opt_coverage=False): """Builds the Uri for the test page with params.""" script_path = os.path.dirname(__file__) test_page_path = os.path.join(script_path, - '../../out/Debug/remoting/unittests/unittests.html') + '../../' + build_path + '/remoting/unittests/unittests.html') test_page_path = 'file://' + os.path.abspath(test_page_path) test_page_params = {} @@ -45,7 +45,7 @@ def BuildTestPageUri(opt_module=None, opt_coverage=False): return '"' + test_page_path + '"' -def BuildCommandLine(chrome_path, opt_module, opt_coverage): +def BuildCommandLine(chrome_path, build_path, opt_module, opt_coverage): """Builds the command line to execute.""" command = [] command.append('"' + chrome_path + '"') @@ -53,7 +53,7 @@ def BuildCommandLine(chrome_path, opt_module, opt_coverage): # The flag |--allow-file-access-from-files| is required so that we can open # JavaScript files using XHR and instrument them for code coverage. command.append(' --allow-file-access-from-files') - test_page_path = BuildTestPageUri(opt_module, opt_coverage) + test_page_path = BuildTestPageUri(build_path, opt_module, opt_coverage) command.append(test_page_path) return ' '.join(command) @@ -67,9 +67,16 @@ def ParseArgs(): help='The path of the chrome binary to run the test.', default=chrome_path) parser.add_argument( - '--module', help='only run tests that belongs to MODULE') + '--module', + help='only run tests that belongs to MODULE') parser.add_argument( - '--coverage', help='run the test with code coverage', action='store_true') + '--coverage', + help='run the test with code coverage', + action='store_true') + parser.add_argument( + '--build-path', + help='The output build path for remoting. (out/Debug)', + default='out/Debug') return parser.parse_args(sys.argv[1:]) @@ -84,7 +91,11 @@ def main(): print 'binary to run the test.' return 1 - command_line = BuildCommandLine(args.chrome_path, args.module, args.coverage) + command_line = BuildCommandLine( + args.chrome_path, + args.build_path, + args.module, + args.coverage) os.system(command_line) return 0 diff --git a/remoting/webapp/base/js/chromoting_event.js b/remoting/webapp/base/js/chromoting_event.js index af10e8e..d7acb72 100644 --- a/remoting/webapp/base/js/chromoting_event.js +++ b/remoting/webapp/base/js/chromoting_event.js @@ -43,6 +43,10 @@ remoting.ChromotingEvent = function(type) { this.browser_version; /** @private {string} */ this.webapp_version; + /** @type {remoting.ChromotingEvent.Os} */ + this.host_os; + /** @type {string} */ + this.host_os_version; /** @type {string} */ this.host_version; /** @private {string} */ @@ -167,6 +171,7 @@ remoting.ChromotingEvent.Role = { /** @enum {number} */ remoting.ChromotingEvent.Os = { + UNKNOWN: 0, LINUX: 1, CHROMEOS: 2, MAC: 3, @@ -176,6 +181,34 @@ remoting.ChromotingEvent.Os = { IOS: 7 }; +/** + * Convert the OS type String into the enum value. + * + * @param {string} type + * @return {remoting.ChromotingEvent.Os} + */ +remoting.ChromotingEvent.toOs = function(type) { + type = type.toLowerCase(); + switch (type) { + case 'linux': + return remoting.ChromotingEvent.Os.LINUX; + case 'chromeos': + return remoting.ChromotingEvent.Os.CHROMEOS; + case 'mac': + return remoting.ChromotingEvent.Os.MAC + case 'windows': + return remoting.ChromotingEvent.Os.WINDOWS; + case 'other': + return remoting.ChromotingEvent.Os.OTHER; + case 'android': + return remoting.ChromotingEvent.Os.ANDROID; + case 'ios': + return remoting.ChromotingEvent.Os.IOS; + default: + return remoting.ChromotingEvent.Os.UNKNOWN; + } +} + /** @enum {number} */ remoting.ChromotingEvent.SessionState = { UNKNOWN: 1, // deprecated. diff --git a/remoting/webapp/base/js/host.js b/remoting/webapp/base/js/host.js index 1a93bec..2c5529d 100644 --- a/remoting/webapp/base/js/host.js +++ b/remoting/webapp/base/js/host.js @@ -38,6 +38,10 @@ remoting.Host = function(hostId) { this.publicKey = ''; /** @type {string} */ this.hostVersion = ''; + /** @type {remoting.ChromotingEvent.Os} */ + this.hostOS = remoting.ChromotingEvent.Os.UNKNOWN; + /** @type {string} */ + this.hostOSVersion = ''; /** @type {Array<string>} */ this.tokenUrlPatterns = []; /** @type {string} */ diff --git a/remoting/webapp/base/js/log_to_server.js b/remoting/webapp/base/js/log_to_server.js index c77cc98..d5819c0 100644 --- a/remoting/webapp/base/js/log_to_server.js +++ b/remoting/webapp/base/js/log_to_server.js @@ -196,8 +196,9 @@ remoting.LogToServer.prototype.log_ = function(entry) { this.authTotalTime_) / 1000.0; entry.addSessionDuration(sessionDurationInSeconds); entry.addApplicationId(); - // The host-version will be blank for logs before a session has been created. - // For example, the signal-strategy log-entries won't have host version info. + // The host-version/os/os-version will be blank for logs before a session has + // been created. For example, the signal-strategy log-entries won't have host + // version info. entry.addHostVersion(this.hostVersion_); // Send the stanza to the debug log. @@ -288,3 +289,18 @@ remoting.LogToServer.prototype.setAuthTotalTime = function(totalTime) { remoting.LogToServer.prototype.setHostVersion = function(hostVersion) { this.hostVersion_ = hostVersion; }; + +/** + * Stub. + * @param {remoting.ChromotingEvent.Os} hostOS Type of the host OS for + current session. + * @return {void} Nothing. + */ +remoting.LogToServer.prototype.setHostOS = function(hostOS) {}; + +/** + * Stub. + * @param {string} hostOSVersion Version of the host OS for current session. + * @return {void} Nothing. + */ +remoting.LogToServer.prototype.setHostOSVersion = function(hostOSVersion) {}; diff --git a/remoting/webapp/base/js/logger.js b/remoting/webapp/base/js/logger.js index ab417c1..443e7e2 100644 --- a/remoting/webapp/base/js/logger.js +++ b/remoting/webapp/base/js/logger.js @@ -28,6 +28,19 @@ remoting.Logger.prototype.setAuthTotalTime = function(totalTime) {}; remoting.Logger.prototype.setHostVersion = function(hostVersion) {}; /** + * @param {remoting.ChromotingEvent.Os} hostOS Type of the OS the host + * for the current session. + * @return {void} Nothing. + */ +remoting.Logger.prototype.setHostOS = function(hostOS) {}; + +/** + * @param {string} hostOSVersion Version of the host Os for current session. + * @return {void} Nothing. + */ +remoting.Logger.prototype.setHostOSVersion = function(hostOSVersion) {}; + +/** * Set the connection type (direct, stun relay). * * @param {string} connectionType @@ -79,4 +92,4 @@ remoting.Logger.MAX_SESSION_ID_AGE = 24 * 60 * 60 * 1000; // to the server, in milliseconds. remoting.Logger.CONNECTION_STATS_ACCUMULATE_TIME = 60 * 1000; -})();
\ No newline at end of file +})(); diff --git a/remoting/webapp/base/js/server_log_entry.js b/remoting/webapp/base/js/server_log_entry.js index 919ad58..2e5d856 100644 --- a/remoting/webapp/base/js/server_log_entry.js +++ b/remoting/webapp/base/js/server_log_entry.js @@ -428,6 +428,21 @@ remoting.ServerLogEntry.prototype.addHostVersion = function(hostVersion) { }; /** + * Stub. + * @param {remoting.ChromotingEvent.Os} hostOS type of the host OS for current + * session. + * @return {void} Nothing. + */ +remoting.ServerLogEntry.prototype.addHostOS = function(hostOS) {}; + +/** + * Stub. + * @param {string} hostOSVersion Version of the host OS for current session. + * @return {void} Nothing. + */ +remoting.ServerLogEntry.prototype.addHostOSVersion = function(hostOSVersion) {}; + +/** * Adds a field specifying the mode to this log entry. * @param {string} mode The current app mode (It2Me, Me2Me, AppRemoting). */ @@ -454,4 +469,4 @@ remoting.ServerLogEntry.prototype.addXmppError = function(xmppError) { } this.set_(remoting.ServerLogEntry.KEY_XMPP_ERROR_RAW_STANZA, xmppError.raw_stanza); -};
\ No newline at end of file +}; diff --git a/remoting/webapp/base/js/session_logger.js b/remoting/webapp/base/js/session_logger.js index ed70992..508041e 100644 --- a/remoting/webapp/base/js/session_logger.js +++ b/remoting/webapp/base/js/session_logger.js @@ -43,6 +43,10 @@ remoting.SessionLogger = function(role, writeLogEntry) { this.authTotalTime_ = 0; /** @private */ this.hostVersion_ = ''; + /** @private {remoting.ChromotingEvent.Os}*/ + this.hostOS_ = remoting.ChromotingEvent.Os.UNKNOWN; + /** @private */ + this.hostOSVersion_ = ''; /** @private */ this.mode_ = remoting.ChromotingEvent.Mode.ME2ME; @@ -68,6 +72,16 @@ remoting.SessionLogger.prototype.setHostVersion = function(hostVersion) { }; /** @override {remoting.Logger} */ +remoting.SessionLogger.prototype.setHostOS = function(hostOS) { + this.hostOS_ = hostOS; +}; + +/** @override {remoting.Logger} */ +remoting.SessionLogger.prototype.setHostOSVersion = function(hostOSVersion) { + this.hostOSVersion_ = hostOSVersion; +}; + +/** @override {remoting.Logger} */ remoting.SessionLogger.prototype.setConnectionType = function(connectionType) { this.connectionType_ = toConnectionType(connectionType); }; @@ -237,6 +251,8 @@ remoting.SessionLogger.prototype.fillEvent_ = function(entry) { entry.connection_type = this.connectionType_; } entry.host_version = this.hostVersion_; + entry.host_os = this.hostOS_; + entry.host_os_version = this.hostOSVersion_; }; /** @@ -421,4 +437,4 @@ function toConnectionType(type) { } } -})();
\ No newline at end of file +})(); diff --git a/remoting/webapp/base/js/session_logger_unittest.js b/remoting/webapp/base/js/session_logger_unittest.js index 035c655..8bf4de8 100644 --- a/remoting/webapp/base/js/session_logger_unittest.js +++ b/remoting/webapp/base/js/session_logger_unittest.js @@ -81,6 +81,8 @@ QUnit.test('logClientSessionStateChange()', function(assert){ logger.setLogEntryMode(Event.Mode.ME2ME); logger.setConnectionType('stun'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); logger.logClientSessionStateChange( remoting.ClientSession.State.FAILED, @@ -102,6 +104,8 @@ QUnit.test('logClientSessionStateChange()', function(assert){ mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.STUN, host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version', session_id: sessionId }); }); @@ -114,6 +118,8 @@ QUnit.test('logClientSessionStateChange() should handle XMPP error', logger.setLogEntryMode(Event.Mode.ME2ME); logger.setConnectionType('stun'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); var xmppError = new remoting.ChromotingEvent.XmppError('<fake-stanza/>'); @@ -137,6 +143,8 @@ QUnit.test('logClientSessionStateChange() should handle XMPP error', mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.STUN, host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version', session_id: sessionId, xmpp_error: { raw_stanza: '<fake-stanza/>' @@ -154,6 +162,8 @@ QUnit.test('logClientSessionStateChange() should handle sessionId change.', logger.setLogEntryMode(Event.Mode.ME2ME); logger.setConnectionType('relay'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); var oldSessionId = logger.getSessionId(); // Expires the session id. @@ -175,7 +185,9 @@ QUnit.test('logClientSessionStateChange() should handle sessionId change.', role: Event.Role.CLIENT, mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.RELAY, - host_version: 'host_version' + host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version' }); verifyEvent(assert, 1, { @@ -189,7 +201,9 @@ QUnit.test('logClientSessionStateChange() should handle sessionId change.', role: Event.Role.CLIENT, mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.RELAY, - host_version: 'host_version' + host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version' }); verifyEvent(assert, 2, { @@ -205,6 +219,8 @@ QUnit.test('logClientSessionStateChange() should handle sessionId change.', mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.RELAY, host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version', session_id: newSessionId }); }); @@ -219,6 +235,8 @@ QUnit.test('logClientSessionStateChange() should log session_duration.', logger.setLogEntryMode(Event.Mode.ME2ME); logger.setConnectionType('direct'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); logger.setAuthTotalTime(1000); clock.tick(2500); @@ -239,6 +257,8 @@ QUnit.test('logClientSessionStateChange() should log session_duration.', mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.DIRECT, host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version', session_id: logger.getSessionId(), session_duration: 1.5 }); @@ -253,6 +273,8 @@ QUnit.test('logStatistics()', function(assert) { logger.setLogEntryMode(Event.Mode.LGAPP); logger.setConnectionType('direct'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); // Log the statistics. logger.logStatistics({ @@ -297,6 +319,8 @@ QUnit.test('logStatistics()', function(assert) { mode: Event.Mode.LGAPP, connection_type: Event.ConnectionType.DIRECT, host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version', session_id: logger.getSessionId(), video_bandwidth: 2.0, capture_latency: 2.0, diff --git a/remoting/webapp/base/js/telemetry_event_writer_unittest.js b/remoting/webapp/base/js/telemetry_event_writer_unittest.js index c7b14c9..9d5b926 100644 --- a/remoting/webapp/base/js/telemetry_event_writer_unittest.js +++ b/remoting/webapp/base/js/telemetry_event_writer_unittest.js @@ -40,6 +40,8 @@ QUnit.module('TelemetryEventWriter', { logger.setLogEntryMode(remoting.ChromotingEvent.Mode.ME2ME); logger.setConnectionType('stun'); logger.setHostVersion('host_version'); + logger.setHostOS(remoting.ChromotingEvent.Os.OTHER); + logger.setHostOSVersion('host_os_version'); }, afterEach: function() { base.dispose(service); @@ -104,7 +106,9 @@ QUnit.test('should send CANCELED event when window is closed while started.', role: Event.Role.CLIENT, mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.STUN, - host_version: 'host_version' + host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version' }); }); }); @@ -129,7 +133,9 @@ QUnit.test('should send CANCELED event when window is closed while connecting.', role: Event.Role.CLIENT, mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.STUN, - host_version: 'host_version' + host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version' }); }); }); @@ -158,7 +164,9 @@ QUnit.test('should send CLOSED event when window is closed while connected.', role: Event.Role.CLIENT, mode: Event.Mode.ME2ME, connection_type: Event.ConnectionType.STUN, - host_version: 'host_version' + host_version: 'host_version', + host_os: remoting.ChromotingEvent.Os.OTHER, + host_os_version: 'host_os_version' }); }); }); diff --git a/remoting/webapp/crd/js/gcd_host_list_api.js b/remoting/webapp/crd/js/gcd_host_list_api.js index 42c8234..2ceed70 100644 --- a/remoting/webapp/crd/js/gcd_host_list_api.js +++ b/remoting/webapp/crd/js/gcd_host_list_api.js @@ -165,6 +165,9 @@ function deviceToHost(device) { host.publicKey = base.getStringAttr(baseState, '_publicKey'); host.jabberId = base.getStringAttr(baseState, '_jabberId', ''); host.hostVersion = base.getStringAttr(baseState, '_hostVersion', ''); + host.hostOS = + remoting.ChromotingEvent.toOs(base.getStringAttr(baseState, '_hostOS')); + host.hostOSVersion = base.getStringAttr(baseState, '_hostOSVersion', ''); var creationTimeMs = base.getNumberAttr(device, 'creationTimeMs', 0); if (creationTimeMs) { host.createdTime = new Date(creationTimeMs).toISOString(); diff --git a/remoting/webapp/crd/js/legacy_host_list_api.js b/remoting/webapp/crd/js/legacy_host_list_api.js index d89b951..0e999b5 100644 --- a/remoting/webapp/crd/js/legacy_host_list_api.js +++ b/remoting/webapp/crd/js/legacy_host_list_api.js @@ -143,6 +143,9 @@ remoting.LegacyHostListApi.prototype.parseHostListResponse_ = host.jabberId = base.getStringAttr(item, 'jabberId', ''); host.publicKey = base.getStringAttr(item, 'publicKey', ''); host.hostVersion = base.getStringAttr(item, 'hostVersion', ''); + host.hostOS = remoting.ChromotingEvent.toOs( + base.getStringAttr(item, 'hostOS')); + host.hostOSVersion = base.getStringAttr(item, 'hostOSVersion', ''); host.tokenUrlPatterns = base.getArrayAttr(item, 'tokenUrlPatterns', []); host.updatedTime = base.getStringAttr(item, 'updatedTime', ''); diff --git a/remoting/webapp/crd/js/me2me_activity.js b/remoting/webapp/crd/js/me2me_activity.js index 5a35735..8d96f67 100644 --- a/remoting/webapp/crd/js/me2me_activity.js +++ b/remoting/webapp/crd/js/me2me_activity.js @@ -87,6 +87,8 @@ remoting.Me2MeActivity.prototype.createLogger_ = function(entryPoint) { var logger = remoting.SessionLogger.createForClient(); logger.setEntryPoint(entryPoint); logger.setHostVersion(this.host_.hostVersion); + logger.setHostOS(this.host_.hostOS); + logger.setHostOSVersion(this.host_.hostOSVersion); logger.setLogEntryMode(Mode.ME2ME); return logger; }; diff --git a/remoting/webapp/files.gni b/remoting/webapp/files.gni index 8a0e9e9..37042a9 100644 --- a/remoting/webapp/files.gni +++ b/remoting/webapp/files.gni @@ -420,9 +420,6 @@ remoting_webapp_background_html_all_js_files += [ "base/js/typecheck.js", "base/js/xhr.js", "base/js/xhr_event_writer.js", - "crd/js/host_installer.js", - "crd/js/host_session.js", - "crd/js/it2me_host_facade.js", ] # |