don't fail test if we can't find strings.xml (fix #1905)

also, make sure apidemos tests run as android even if DEVICE isn't set
This commit is contained in:
Jonathan Lipps
2014-02-14 10:53:58 -08:00
parent a8f247a3d6
commit 6f4f275180
3 changed files with 14 additions and 3 deletions

View File

@@ -294,8 +294,11 @@ Android.prototype.pushStrings = function (cb) {
logger.debug(makeStrings);
exec(makeStrings, { maxBuffer: 524288 }, function (err, stdout, stderr) {
if (err) {
// if we can't get strings, just dump an empty json and continue
logger.warn("Error getting strings.xml from apk");
logger.debug(stderr);
return cb(new Error("Could not make strings from apk"));
var remoteFile = path.resolve(remotePath, stringsJson);
return this.adb.shell("echo '{}' > " + remoteFile, cb);
}
var jsonFile = path.resolve(outputPath, stringsJson);
this.adb.push(jsonFile, remotePath, function (err) {

View File

@@ -3,7 +3,8 @@
var getAppPath = require('../../../helpers/app').getAppPath;
module.exports = {
app: getAppPath('ApiDemos'),
app: getAppPath('ApiDemos', 'android'),
device: 'Android',
'app-package': 'com.example.android.apis',
'app-activity': '.ApiDemos'
};

View File

@@ -3,7 +3,14 @@
var env = require('./env'),
path = require('path');
module.exports.getAppPath = function (app) {
module.exports.getAppPath = function (app, device) {
if (device && device[0] === "i") {
env.IOS = true;
env.ANDROID = false;
} else if (device && device.toLowerCase() === "android") {
env.ANDROID = true;
env.IOS = false;
}
if (env.IOS) {
return path.resolve(__dirname, "../../sample-code/apps/" + app +
"/build/Release-iphonesimulator/" + app + ".app");