just use javascript's new operator rather than adding levels of abstraction

This commit is contained in:
Jonathan Lipps
2013-10-21 12:24:05 -07:00
parent c3db317842
commit 3785fe5ca9
4 changed files with 9 additions and 11 deletions

View File

@@ -939,6 +939,4 @@ ADB.prototype.sendTelnetCommand = function(command, cb) {
};
module.exports = function(opts, android) {
return new ADB(opts, android);
};
module.exports = ADB;

View File

@@ -4,7 +4,7 @@ var errors = require('../../server/errors.js')
, exec = require('child_process').exec
, path = require('path')
, fs = require('fs')
, adb = require('./adb.js')
, ADB = require('./adb.js')
, helpers = require('../../helpers.js')
, getTempPath = helpers.getTempPath
, _ = require('underscore')
@@ -14,7 +14,7 @@ var errors = require('../../server/errors.js')
, helperJarPath = path.resolve(__dirname, 'helpers')
, async = require('async')
, androidController = require('./android-controller.js')
, uiautomator = require('./uiautomator.js')
, UiAutomator = require('./uiautomator.js')
, UnknownError = errors.UnknownError;
var Android = function(opts) {
@@ -146,8 +146,8 @@ Android.prototype.start = function(cb, onDie) {
if (this.adb === null) {
// Pass Android opts and Android ref to adb.
this.adb = adb(this.opts, this);
this.uiautomator = uiautomator(this.adb, this.opts);
this.adb = new ADB(this.opts);
this.uiautomator = new UiAutomator(this.adb, this.opts);
this.startAppium(onLaunch, onExit);
} else {
logger.error("Tried to start ADB when we already have one running!");

View File

@@ -9,7 +9,7 @@ var Android = require('./android.js').Android
, async = require('async')
, through = require('through')
, isWindows = require('../../helpers.js').isWindows()
, adb = require('./adb.js');
, ADB = require('./adb.js');
var ChromeAndroid = function(opts) {
this.initialize(opts);
@@ -30,7 +30,7 @@ var ChromeAndroid = function(opts) {
_.extend(ChromeAndroid.prototype, Android.prototype);
ChromeAndroid.prototype.start = function(cb, onDie) {
this.adb = new adb(this.opts);
this.adb = new ADB(this.opts);
this.onDie = onDie;
this.onChromedriverStart = null;
async.waterfall([

View File

@@ -1,6 +1,6 @@
"use strict";
var adb = require('./adb.js')
var ADB = require('./adb.js')
, _ = require('underscore')
, deviceCommon = require('../common.js')
, proxyTo = deviceCommon.proxyTo
@@ -34,7 +34,7 @@ Selendroid.prototype.start = function(cb) {
logger.info("Starting selendroid server");
var opts = _.clone(this.opts);
opts.devicePort = 8080; // selendroid listens on 8080 on the device
this.adb = new adb(opts);
this.adb = new ADB(opts);
async.waterfall([
function(cb) { this.ensureServerExists(cb); }.bind(this),