Bug 1106903 - Move BaseTest/UITest.runTest into BaseRobocopTest. r=mcomella
authorcrazyprodigy <mrjohnsonalex@gmail.com>
Thu, 05 Nov 2015 13:29:39 -0500
changeset 307648 e4fea01b76e9c59b5402851b82dedc9b09c19f8a
parent 307647 26cd9f65b09050cf6753b15ae2f6fa394af49519
child 307649 346ddee185b995b5900051d692e7d2c2641529a1
push id7333
push usernalexander@mozilla.com
push dateMon, 09 Nov 2015 18:31:16 +0000
reviewersmcomella
bugs1106903
milestone45.0a1
Bug 1106903 - Move BaseTest/UITest.runTest into BaseRobocopTest. r=mcomella
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseRobocopTest.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/UITest.java
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseRobocopTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseRobocopTest.java
@@ -178,16 +178,33 @@ public abstract class BaseRobocopTest ex
         mStringHelper = StringHelper.get();
 
         mSolo = new Solo(getInstrumentation(), tempActivity);
         mDriver = new FennecNativeDriver(tempActivity, mSolo, mRootPath);
         mActions = new FennecNativeActions(tempActivity, mSolo, getInstrumentation(), mAsserter);
     }
 
     @Override
+    protected void runTest() throws Throwable {
+        try {
+            super.runTest();
+        } catch (Throwable t) {
+            // save screenshot -- written to /mnt/sdcard/Robotium-Screenshots
+            // as <filename>.jpg
+            mSolo.takeScreenshot("robocop-screenshot-"+getClass().getName());
+            if (mAsserter != null) {
+                mAsserter.dumpLog("Exception caught during test!", t);
+                mAsserter.ok(false, "Exception caught", t.toString());
+            }
+            // re-throw to continue bail-out
+            throw t;
+        }
+    }
+
+    @Override
     public void tearDown() throws Exception {
         try {
             mAsserter.endTest();
 
             // By default, we don't quit Fennec on finish, and we don't finish
             // all opened activities. Not quiting Fennec entirely is intended to
             // make life better for local testers, who might want to alter a
             // test that is under development rather than Fennec itself. Not
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseTest.java
@@ -118,33 +118,16 @@ abstract class BaseTest extends BaseRobo
     protected void initializeProfile() {
         final GeckoProfile profile = getTestProfile();
 
         // In Robocop tests, we typically don't get initialized correctly, because
         // GeckoProfile doesn't create the profile directory.
         profile.enqueueInitialization(profile.getDir());
     }
 
-    @Override
-    protected void runTest() throws Throwable {
-        try {
-            super.runTest();
-        } catch (Throwable t) {
-            // save screenshot -- written to /mnt/sdcard/Robotium-Screenshots
-            // as <filename>.jpg
-            mSolo.takeScreenshot("robocop-screenshot-"+getClass().getName());
-            if (mAsserter != null) {
-                mAsserter.dumpLog("Exception caught during test!", t);
-                mAsserter.ok(false, "Exception caught", t.toString());
-            }
-            // re-throw to continue bail-out
-            throw t;
-        }
-    }
-
     /**
      * Click on the URL bar to focus it and enter editing mode.
      */
     protected final void focusUrlBar() {
         // Click on the browser toolbar to enter editing mode
         mSolo.waitForView(R.id.browser_toolbar);
         final View toolbarView = mSolo.getView(R.id.browser_toolbar);
         mSolo.clickOnView(toolbarView);
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/UITest.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/UITest.java
@@ -53,33 +53,16 @@ abstract class UITest extends BaseRoboco
         initComponents();
         initHelpers();
 
         // Ensure Robocop tests have access to network, and are run with Display powered on.
         throwIfHttpGetFails();
         throwIfScreenNotOn();
     }
 
-    @Override
-    protected void runTest() throws Throwable {
-        try {
-            super.runTest();
-        } catch (Throwable t) {
-            // save screenshot -- written to /mnt/sdcard/Robotium-Screenshots
-            // as <filename>.jpg
-            mSolo.takeScreenshot("robocop-screenshot-"+getClass().getName());
-            if (mAsserter != null) {
-                mAsserter.dumpLog("Exception caught during test!", t);
-                mAsserter.ok(false, "Exception caught", t.toString());
-            }
-            // re-throw to continue bail-out
-            throw t;
-        }
-    }
-
     private void initComponents() {
         mAboutHome = new AboutHomeComponent(this);
         mAppMenu = new AppMenuComponent(this);
         mGeckoView = new GeckoViewComponent(this);
         mTabStrip = new TabStripComponent(this);
         mToolbar = new ToolbarComponent(this);
     }