From a698e19d2c56ee2ac4dcb0da4e01714a02c6ced5 Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Fri, 14 Feb 2014 15:39:52 -0800 Subject: [PATCH] stub out some functions used to get webviews going on android --- lib/devices/android/adb.js | 5 +++++ lib/devices/android/android-hybrid.js | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lib/devices/android/android-hybrid.js diff --git a/lib/devices/android/adb.js b/lib/devices/android/adb.js index ad7709395..ddb59fd7e 100644 --- a/lib/devices/android/adb.js +++ b/lib/devices/android/adb.js @@ -648,6 +648,11 @@ ADB.prototype.forwardPort = function (systemPort, devicePort, cb) { this.exec("forward tcp:" + systemPort + " tcp:" + devicePort, cb); }; +ADB.prototype.forwardAbstractPort = function (systemPort, devicePort, cb) { + this.debug("Forwarding system:" + systemPort + " to abstract device:" + devicePort); + this.exec("forward tcp:" + systemPort + " localabstract:" + devicePort, cb); +}; + ADB.prototype.isDeviceConnected = function (cb) { this.getConnectedDevices(function (err, devices) { if (err) { diff --git a/lib/devices/android/android-hybrid.js b/lib/devices/android/android-hybrid.js new file mode 100644 index 000000000..6dcb366ab --- /dev/null +++ b/lib/devices/android/android-hybrid.js @@ -0,0 +1,22 @@ +"use strict"; + +var logger = require('../../server/logger.js').get('appium') + , _ = require('underscore') + , deviceCommon = require('../common.js') + , rd = require('../remote-debugger.js'); + +var getWebviews = function (cb) { + var webviews = []; + this.adb.shell("cat /proc/net/unix", function (err, out) { + _.each(out.split("\n"), function (line) { + if (line.indexOf("@webview_devtools_remote_") !== -1) { + webviews.push(/@(webview_devtools_remote_.+)$/.exec(line)[1]); + } + }); + }); + return webviews; +}; + +var setupPorts = function (localPort, abstractDevicePort, cb) { + this.adb.forwardAbstractPort(localPort, abstractDevicePort, cb); +};