diff --git a/build/mobile/robocop/FennecNativeDriver.java.in b/build/mobile/robocop/FennecNativeDriver.java.in index 923a4a25d3a..17c7f9663f9 100644 --- a/build/mobile/robocop/FennecNativeDriver.java.in +++ b/build/mobile/robocop/FennecNativeDriver.java.in @@ -393,7 +393,7 @@ public class FennecNativeDriver implements Driver { String[] lines = data.split("\n"); for (int i = 0; i < lines.length; i++) { - String[] parts = lines[i].split("="); + String[] parts = lines[i].split("=", 2); retVal.put(parts[0].trim(), parts[1].trim()); } return retVal; diff --git a/mobile/android/base/tests/BaseTest.java.in b/mobile/android/base/tests/BaseTest.java.in index 1ecee4644b1..4f8f6e16c49 100755 --- a/mobile/android/base/tests/BaseTest.java.in +++ b/mobile/android/base/tests/BaseTest.java.in @@ -66,6 +66,14 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2 { mProfile = (String)config.get("profile"); i.putExtra("args", "-no-remote -profile " + mProfile); + String envString = (String)config.get("envvars"); + if (envString != "") { + String[] envStrings = envString.split(","); + for (int iter = 0; iter < envStrings.length; iter++) { + i.putExtra("env" + iter, envStrings[iter]); + } + } + // Start the activity setActivityIntent(i); mActivity = getActivity(); diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py index 7a82f9c229a..130c1865372 100644 --- a/testing/mochitest/runtestsremote.py +++ b/testing/mochitest/runtestsremote.py @@ -386,6 +386,41 @@ class MochiRemote(Mochitest): if failed > 0: return 1 return 0 + + def buildRobotiumConfig(self, options, browserEnv): + deviceRoot = self._dm.getDeviceRoot() + fHandle = tempfile.NamedTemporaryFile(suffix='.config', + prefix='robotium-', + dir=os.getcwd(), + delete=False) + fHandle.write("profile=%s\n" % (self.remoteProfile)) + fHandle.write("logfile=%s\n" % (options.remoteLogFile)) + fHandle.write("host=http://mochi.test:8888/tests\n") + fHandle.write("rawhost=http://%s:%s/tests\n" % (options.remoteWebServer, options.httpPort)) + + if browserEnv: + envstr = "" + delim = "" + for key, value in browserEnv.items(): + try: + value.index(',') + print "Found: Error an ',' in our value, unable to process value." + except ValueError, e: + envstr += "%s%s=%s" % (delim, key, value) + delim = "," + + fHandle.write("envvars=%s\n" % envstr) + fHandle.close() + + self._dm.removeFile(os.path.join(deviceRoot, "robotium.config")) + self._dm.pushFile(fHandle.name, os.path.join(deviceRoot, "robotium.config")) + os.unlink(fHandle.name) + + def buildBrowserEnv(self, options): + browserEnv = Mochitest.buildBrowserEnv(self, options) + self.buildRobotiumConfig(options, browserEnv) + return browserEnv + def main(): scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) @@ -434,21 +469,8 @@ def main(): mp.read(options.robocop) robocop_tests = mp.active_tests(exists=False) - fHandle = tempfile.NamedTemporaryFile(suffix='.config', - prefix='robotium-', - dir=os.getcwd(), - delete=False) - fHandle.write("profile=%s\n" % (mochitest.remoteProfile)) - fHandle.write("logfile=%s\n" % (options.remoteLogFile)) - fHandle.write("host=http://mochi.test:8888/tests\n") - fHandle.write("rawhost=http://%s:%s/tests\n" % (options.remoteWebServer, options.httpPort)) - fHandle.close() - deviceRoot = dm.getDeviceRoot() - + deviceRoot = dm.getDeviceRoot() dm.removeFile(os.path.join(deviceRoot, "fennec_ids.txt")) - dm.removeFile(os.path.join(deviceRoot, "robotium.config")) - dm.pushFile(fHandle.name, os.path.join(deviceRoot, "robotium.config")) - os.unlink(fHandle.name) fennec_ids = os.path.abspath("fennec_ids.txt") if not os.path.exists(fennec_ids) and options.robocopIds: fennec_ids = options.robocopIds