@Override protected void setUp() throws Exception { super.setUp(); final String rootPath = FennecInstrumentationTestRunner.getFennecArguments().getString("deviceroot"); final HashMap config = loadConfigTable(rootPath); final Intent intent = createActivityIntent(config); setActivityIntent(intent); // Start the activity. mActivity = getActivity(); if (getTestType() == Type.TALOS) { mAsserter = new FennecTalosAssert(); } else { mAsserter = new FennecMochitestAssert(); } final String logFile = (String) config.get("logfile"); mAsserter.setLogFile(logFile); mAsserter.setTestName(this.getClass().getName()); mSolo = new Solo(getInstrumentation(), mActivity); mDriver = new FennecNativeDriver(mActivity, mSolo, rootPath); mActions = new FennecNativeActions(mActivity, mSolo, getInstrumentation(), mAsserter); mBaseHostnameUrl = ((String) config.get("host")).replaceAll("(/$)", ""); mBaseIpUrl = ((String) config.get("rawhost")).replaceAll("(/$)", ""); // Helpers depend on components so initialize them first. initComponents(); initHelpers(); }
@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(); }