diff --git a/client/karma.js b/client/karma.js index 991f7e915..6c59bda4d 100644 --- a/client/karma.js +++ b/client/karma.js @@ -10,6 +10,7 @@ var Karma = function (socket, iframe, opener, navigator, location) { var self = this var queryParams = util.parseQueryParams(location.search) var browserId = queryParams.id || util.generateId('manual-') + var displayName = queryParams.displayName var returnUrl = queryParams['return_url' + ''] || null var resultsBufferLimit = 50 @@ -233,11 +234,14 @@ var Karma = function (socket, iframe, opener, navigator, location) { socket.io.engine.on('upgrade', function () { resultsBufferLimit = 1 }) - - socket.emit('register', { + var info = { name: navigator.userAgent, id: browserId - }) + } + if (displayName) { + info.displayName = displayName + } + socket.emit('register', info) }) } diff --git a/lib/config.js b/lib/config.js index a0419ef40..7181ae979 100644 --- a/lib/config.js +++ b/lib/config.js @@ -195,7 +195,11 @@ var normalizeConfig = function (config, configFilePath) { } module[type + ':' + name] = ['factory', function (injector) { - return injector.createChild([locals], [token]).get(token) + var plugin = injector.createChild([locals], [token]).get(token) + if (type === 'launcher' && helper.isDefined(definition.displayName)) { + plugin.displayName = definition.displayName + } + return plugin }] hasSomeInlinedPlugin = true }) diff --git a/lib/launcher.js b/lib/launcher.js index b5996279b..988133176 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -1,6 +1,7 @@ var Promise = require('bluebird') var Batch = require('batch') +var helper = require('./helper') var log = require('./logger').create('launcher') var baseDecorator = require('./launchers/base').decoratorFactory @@ -88,7 +89,7 @@ var Launcher = function (emitter, injector) { } batch.push(function (done) { - log.info('Starting browser %s', browser.name) + log.info('Starting browser %s', helper.isDefined(browser.displayName) ? browser.displayName : browser.name) browser.start(url) browser.on('browser_process_failure', function () { diff --git a/lib/launchers/base.js b/lib/launchers/base.js index 3ed73d59d..0ddb0dae9 100644 --- a/lib/launchers/base.js +++ b/lib/launchers/base.js @@ -3,6 +3,7 @@ var EventEmitter = require('events').EventEmitter var Promise = require('bluebird') var log = require('../logger').create('launcher') +var helper = require('../helper') var BEING_CAPTURED = 1 var CAPTURED = 2 @@ -38,7 +39,7 @@ var BaseLauncher = function (id, emitter) { this.error = null this.state = BEING_CAPTURED - this.emit('start', url + '?id=' + this.id) + this.emit('start', url + '?id=' + this.id + (helper.isDefined(self.displayName) ? '&displayName=' + encodeURIComponent(self.displayName) : '')) } this.kill = function () { diff --git a/lib/server.js b/lib/server.js index 96247b10b..892a1b55e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -224,7 +224,7 @@ Server.prototype._start = function (config, launcher, preprocess, fileList, webS } else { newBrowser = self._injector.createChild([{ id: ['value', info.id || null], - fullName: ['value', info.name], + fullName: ['value', (helper.isDefined(info.displayName) ? info.displayName : info.name)], socket: ['value', socket] }]).instantiate(Browser)