@Override protected void setUp() throws Exception { // Load config file from root path (setup by python script) String rootPath = FennecInstrumentationTestRunner.getFennecArguments().getString("deviceroot"); String configFile = FennecNativeDriver.getFile(rootPath + "/robotium.config"); HashMap config = FennecNativeDriver.convertTextToTable(configFile); mLogFile = (String) config.get("logfile"); mBaseUrl = ((String) config.get("host")).replaceAll("(/$)", ""); mRawBaseUrl = ((String) config.get("rawhost")).replaceAll("(/$)", ""); // Initialize the asserter if (getTestType() == TEST_TALOS) { mAsserter = new FennecTalosAssert(); } else { mAsserter = new FennecMochitestAssert(); } mAsserter.setLogFile(mLogFile); mAsserter.setTestName(this.getClass().getName()); // Create the intent to be used with all the important arguments. Intent i = new Intent(Intent.ACTION_MAIN); 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(); // Set up Robotium.solo and Driver objects mSolo = new Solo(getInstrumentation(), mActivity); mDriver = new FennecNativeDriver(mActivity, mSolo, rootPath); mActions = new FennecNativeActions(mActivity, mSolo, getInstrumentation(), mAsserter); mDevice = new Device(); mDatabaseHelper = new DatabaseHelper(mActivity, mAsserter); mStringHelper = new StringHelper(); }
private static HashMap loadConfigTable(final String rootPath) { final String configFile = FennecNativeDriver.getFile(rootPath + "/robotium.config"); return FennecNativeDriver.convertTextToTable(configFile); }