we don't use webatoms for android now that we use chrome

This commit is contained in:
Jonathan Lipps
2013-10-18 14:41:39 -07:00
parent 138f22f319
commit f7c8f9e6cb
2 changed files with 6 additions and 71 deletions

View File

@@ -20,34 +20,13 @@ androidController.keyevent = function(keycode, metastate, cb) {
};
androidController.findElement = function(strategy, selector, cb) {
if (this.inWebView()) {
this.findWebElementOrElements(strategy, selector, false, "", cb);
} else {
this.findUIElementOrElements(strategy, selector, false, "", cb);
}
this.findUIElementOrElements(strategy, selector, false, "", cb);
};
androidController.findElements = function(strategy, selector, cb) {
if (this.inWebView()) {
this.findWebElementOrElements(strategy, selector, true, "", cb);
} else {
this.findUIElementOrElements(strategy, selector, true, "", cb);
}
this.findUIElementOrElements(strategy, selector, true, "", cb);
};
androidController.findWebElementOrElements = function(strategy, selector, many, ctx, cb) {
var ext = many ? 's' : '';
var atomsElement = this.getAtomsElement(ctx);
var doFind = function(findCb) {
this.executeAtom('find_element' + ext, [strategy, selector, atomsElement], function(err, res) {
this.handleFindCb(err, res, many, findCb);
}.bind(this));
}.bind(this);
this.waitForCondition(this.implicitWaitMs, doFind, cb);
};
androidController.getAtomsElement = deviceCommon.getAtomsElement;
androidController.findUIElementOrElements = function(strategy, selector, many, context, cb) {
var params = {
strategy: strategy
@@ -101,19 +80,11 @@ androidController.handleFindCb = function(err, res, many, findCb) {
};
androidController.findElementFromElement = function(element, strategy, selector, cb) {
if (this.inWebView()) {
this.findWebElementOrElements(strategy, selector, false, element, cb);
} else {
this.findUIElementOrElements(strategy, selector, false, element, cb);
}
this.findUIElementOrElements(strategy, selector, false, element, cb);
};
androidController.findElementsFromElement = function(element, strategy, selector, cb) {
if (this.inWebView()) {
this.findWebElementOrElements(strategy, selector, true, element, cb);
} else {
this.findUIElementOrElements(strategy, selector, true, element, cb);
}
this.findUIElementOrElements(strategy, selector, true, element, cb);
};
androidController.setValueImmediate = function(elementId, value, cb) {
@@ -129,13 +100,7 @@ androidController.setValue = function(elementId, value, cb) {
};
androidController.click = function(elementId, cb) {
if (this.inWebView()) {
this.useAtomsElement(elementId, cb, function(atomsElement) {
this.executeAtom('tap', [atomsElement], cb);
}.bind(this));
} else {
this.proxy(["element:click", {elementId: elementId}], cb);
}
this.proxy(["element:click", {elementId: elementId}], cb);
};
androidController.touchLongClick = function(elementId, cb) {
@@ -623,14 +588,7 @@ androidController.clearWebView = function(cb) {
};
androidController.execute = function(script, args, cb) {
if (this.inWebView()) {
this.convertElementForAtoms(args, function(err, res) {
if (err) return cb(null, res);
this.executeAtom('execute_script', [script, res], cb);
}.bind(this));
} else {
cb(new NotYetImplementedError(), null);
}
cb(new NotYetImplementedError(), null);
};
androidController.convertElementForAtoms = deviceCommon.convertElementForAtoms;

View File

@@ -39,7 +39,6 @@ Android.prototype.initialize = function(opts) {
this.swipeStepsPerSec = 28;
this.asyncWaitMs = 0;
this.remote = null;
this.webElementIds = [];
this.curWindowHandle = null;
this.capabilities = {
platform: 'LINUX'
@@ -52,10 +51,6 @@ Android.prototype.initialize = function(opts) {
};
};
Android.prototype.inWebView = function() {
return this.curWindowHandle !== null;
};
// Clear data, close app, then start app.
Android.prototype.fastReset = function(cb) {
async.series([
@@ -260,24 +255,6 @@ Android.prototype.push = function(elem) {
Android.prototype.waitForCondition = deviceCommon.waitForCondition;
Android.prototype.executeAtom = function(atom, args, cb, alwaysDefaultFrame) {
var frames = alwaysDefaultFrame === true ? [] : this.curWebFrames;
this.returnedFromExecuteAtom = false;
this.processingRemoteCmd = true;
this.remote.executeAtom(atom, args, frames, function(err, res) {
this.processingRemoteCmd = false;
if (!this.returnedFromExecuteAtom) {
this.returnedFromExecuteAtom = true;
res = this.parseExecuteResponse(res);
cb(err, res);
}
}.bind(this));
};
Android.prototype.parseExecuteResponse = deviceCommon.parseExecuteResponse;
Android.prototype.parseElementResponse = deviceCommon.parseElementResponse;
Android.prototype.useAtomsElement = deviceCommon.useAtomsElement;
Android.prototype.setCommandTimeout = function(secs, cb) {
logger.info("Setting command timeout for android to " + secs + " secs");
this.origCommandTimeoutMs = this.commandTimeoutMs;