Bug 758392 - Create abstract getTestType() method in BaseTest. r=gbrown f=jmaher
☠☠ backed out by b7ad724a8f7e ☠ ☠
authorBrian Nicholson <bnicholson@mozilla.com>
Fri, 25 May 2012 17:26:04 -0700
changeset 95000 551fb80a2dca1fd786ae4ac6058bb913e3d8649f
parent 94999 be99d6a4451331408f1b57068ccfecb1fe091765
child 95001 ad75e96b8be1147d921ba5b4938671b4414a8408
push id22770
push userryanvm@gmail.com
push dateSat, 26 May 2012 12:07:39 +0000
treeherdermozilla-central@cd62c4b8f500 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs758392
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758392 - Create abstract getTestType() method in BaseTest. r=gbrown f=jmaher
mobile/android/base/tests/BaseTest.java.in
mobile/android/base/tests/ContentProviderTest.java.in
mobile/android/base/tests/PixelTest.java.in
mobile/android/base/tests/testAboutPage.java.in
mobile/android/base/tests/testAwesomebar.java.in
mobile/android/base/tests/testAxisLocking.java.in
mobile/android/base/tests/testBookmark.java.in
mobile/android/base/tests/testBookmarklets.java.in
mobile/android/base/tests/testBrowserProvider.java.in
mobile/android/base/tests/testBrowserProviderPerf.java.in
mobile/android/base/tests/testCheck.java.in
mobile/android/base/tests/testCheck2.java.in
mobile/android/base/tests/testCheck3.java.in
mobile/android/base/tests/testFlingCorrectness.java.in
mobile/android/base/tests/testFormHistory.java.in
mobile/android/base/tests/testJarReader.java.in
mobile/android/base/tests/testLoad.java.in
mobile/android/base/tests/testNewTab.java.in
mobile/android/base/tests/testOverscroll.java.in
mobile/android/base/tests/testPan.java.in
mobile/android/base/tests/testPanCorrectness.java.in
mobile/android/base/tests/testPasswordEncrypt.java.in
mobile/android/base/tests/testPasswordProvider.java.in
mobile/android/base/tests/testPermissions.java.in
mobile/android/base/tests/testWebContentContextMenu.java.in
mobile/android/base/tests/test_bug720538.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -27,32 +27,37 @@ abstract class BaseTest extends Activity
 
     private static Class<Activity> mLauncherActivityClass;
     private Activity mActivity;
     protected Solo mSolo;
     protected Driver mDriver;
     protected Assert mAsserter;
     protected Actions mActions;
     protected String mBaseUrl;
-    private String mTestType;
     private String mLogFile;
     protected String mProfile;
 
+    protected static final int TEST_MOCHITEST = 0;
+    protected static final int TEST_TALOS = 1;
+
     static {
         try {
             mLauncherActivityClass = (Class<Activity>)Class.forName(LAUNCH_ACTIVITY_FULL_CLASSNAME);
         } catch (ClassNotFoundException e) {
             throw new RuntimeException(e);
         }
     }
 
     public BaseTest() {
         super(TARGET_PACKAGE_ID, mLauncherActivityClass);
     }
 
+    // Must return either TEST_MOCHITEST or TEST_TALOS
+    protected abstract int getTestType();
+
     @Override
     protected void setUp() throws Exception {
         // Load config file from sdcard (setup by python script)
         String configFile = FennecNativeDriver.getFile("/mnt/sdcard/robotium.config");
         HashMap config = FennecNativeDriver.convertTextToTable(configFile);
 
         // Create the intent to be used with all the important arguments.
         Intent i = new Intent(Intent.ACTION_MAIN);
@@ -65,22 +70,19 @@ abstract class BaseTest extends Activity
 
         // Set up Robotium.solo and Driver objects
         mSolo = new Solo(getInstrumentation());
         mDriver = new FennecNativeDriver(mActivity, mSolo);
         mActions = new FennecNativeActions(mActivity, mSolo, getInstrumentation());
 
         mLogFile = (String)config.get("logfile");
         mBaseUrl = ((String)config.get("host")).replaceAll("(/$)", "");
-    }
 
-    public void setTestType(String type) {
-        mTestType = type;
-
-        if (mTestType.equals("talos")) {
+        // Initialize the asserter
+        if (getTestType() == TEST_TALOS) {
             mAsserter = new FennecTalosAssert();
         } else {
             mAsserter = new FennecMochitestAssert();
         }
         mAsserter.setLogFile(mLogFile);
         mAsserter.setTestName(this.getClass().getName());
     }
 
--- a/mobile/android/base/tests/ContentProviderTest.java.in
+++ b/mobile/android/base/tests/ContentProviderTest.java.in
@@ -41,16 +41,19 @@ abstract class ContentProviderTest exten
     protected ClassLoader mClassLoader;
     protected ArrayList<Runnable> mTests;
     protected Class mProviderClass;
     protected Class mProviderContract;
     protected String mProviderAuthority;
     protected IsolatedContext mProviderContext;
     protected String mLogFile;
 
+    protected static final int TEST_MOCHITEST = 0;
+    protected static final int TEST_TALOS = 1;
+
     private class ContentProviderMockContext extends MockContext {
         @Override
         public Resources getResources() {
             return getContext().getResources();
         }
 
         @Override
         public File getDir(String name, int mode) {
@@ -183,40 +186,42 @@ abstract class ContentProviderTest exten
         String param = (String) mProviderContract.getField(paramName).get(null);
         return uri.buildUpon().appendQueryParameter(param, value).build();
     }
 
     public void setTestName(String testName) {
         mAsserter.setTestName(this.getClass().getName() + " - " + testName);
     }
 
-    public void setTestType(String type) {
-        if (type.equals("talos")) {
-            mAsserter = new FennecTalosAssert();
-        } else {
-            mAsserter = new FennecMochitestAssert();
-        }
-
-        mAsserter.setLogFile(mLogFile);
-        mAsserter.setTestName(this.getClass().getName());
-    }
+    // Must return either TEST_MOCHITEST or TEST_TALOS
+    protected abstract int getTestType();
 
     public void setUp() throws Exception {
         throw new Exception("You should call setUp(providerClassName, authorityUriField) instead");
     }
 
     public void setUp(String providerClassName, String authorityUriField) throws Exception {
         super.setUp();
 
         mClassLoader = getContext().getClassLoader();
         mTests = new ArrayList<Runnable>();
 
         loadRobotiumConfig();
         setUpProviderClassAndAuthority(providerClassName, authorityUriField);
         setUpContentProvider();
+
+        // Initialize the asserter
+        if (getTestType() == TEST_TALOS) {
+            mAsserter = new FennecTalosAssert();
+        } else {
+            mAsserter = new FennecMochitestAssert();
+        }
+
+        mAsserter.setLogFile(mLogFile);
+        mAsserter.setTestName(this.getClass().getName());
     }
 
     public void tearDown() throws Exception {
         if (Build.VERSION.SDK_INT >= 11) {
             mProvider.shutdown();
         }
 
         String databaseName = null;
--- a/mobile/android/base/tests/PixelTest.java.in
+++ b/mobile/android/base/tests/PixelTest.java.in
@@ -1,14 +1,14 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
-class PixelTest extends BaseTest {
+abstract class PixelTest extends BaseTest {
     private static final long PAINT_CLEAR_DELAY = 500; // milliseconds
 
     protected final PaintedSurface loadAndPaint(String url) {
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
         loadUrl(url);
         paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
         PaintedSurface p = mDriver.getPaintedSurface();
         if (p == null) {
--- a/mobile/android/base/tests/testAboutPage.java.in
+++ b/mobile/android/base/tests/testAboutPage.java.in
@@ -1,18 +1,22 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Activity;
 import android.util.Log;
 
 public class testAboutPage extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testAboutPage() {
-        setTestType("mochitest");
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // Load the about: page
         String url = "about:";
         loadUrl(url);
 
         Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar");
         mAsserter.ok(awesomebar != null && awesomebar.getText() != null && awesomebar.getText().matches("About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)"), "page title match", "about: page title is correct");
--- a/mobile/android/base/tests/testAwesomebar.java.in
+++ b/mobile/android/base/tests/testAwesomebar.java.in
@@ -1,17 +1,20 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
 public class testAwesomebar extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testAwesomebar() {
-        setTestType("mochitest");
-
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         loadUrl(url);
 
         mDriver.setupScrollHandling();
         // Calculate where we should be dragging.
         int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2;
--- a/mobile/android/base/tests/testAxisLocking.java.in
+++ b/mobile/android/base/tests/testAxisLocking.java.in
@@ -8,18 +8,22 @@ import android.app.Instrumentation;
  * Basic test for axis locking behaviour.
  * - Load page and verify it draws
  * - Drag page upwards 100 pixels at a 5-degree angle off the vertical axis
  * - Verify that the 5-degree angle was thrown out and it dragged vertically
  * - Drag page upwards at a 45-degree angle
  * - Verify that the 45-degree angle was not thrown out and it dragged diagonally
  */
 public class testAxisLocking extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testAxisLocking() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -25,18 +25,22 @@ public class testBookmark extends BaseTe
     private Method mIsBookmarked;
     private String[] defaultBookmarks = new String[] {
         "about:firefox",
         "about:home",
         "http://support.mozilla.org/en-US/mobile",
         "https://addons.mozilla.org/en-US/android/"
     };
 
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testBookmark() {
-        setTestType("mochitest");
         BOOKMARK_URL = getAbsoluteUrl(BOOKMARK_URL);
 
         mClassLoader = getActivity().getApplicationContext().getClassLoader();
         try {
             Class browserDB = mClassLoader.loadClass("org.mozilla.gecko.db.BrowserDB");
             mAddBookmark = browserDB.getMethod("addBookmark", ContentResolver.class, String.class, String.class);
             mRemoveBookmark = browserDB.getMethod("removeBookmarksWithURL", ContentResolver.class, String.class);
             mIsBookmarked = browserDB.getMethod("isBookmark", ContentResolver.class, String.class);
--- a/mobile/android/base/tests/testBookmarklets.java.in
+++ b/mobile/android/base/tests/testBookmarklets.java.in
@@ -5,23 +5,27 @@ import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Activity;
 import android.content.ContentValues;
 import android.content.ContentResolver;
 import android.database.Cursor;
 import android.net.Uri;
 import android.provider.Browser;
 
 public class testBookmarklets extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testBookmarklets() {
         final String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         final String title = "alertBookmarklet";
         final String js = "javascript:alert(12 + .34)";
         boolean alerted;
 
-        setTestType("mochitest");
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // load a standard page so bookmarklets work
         loadUrl(url);
 
         // verify that user-entered bookmarklets do *not* work
         enterUrl(js);
         mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
--- a/mobile/android/base/tests/testBrowserProvider.java.in
+++ b/mobile/android/base/tests/testBrowserProvider.java.in
@@ -75,16 +75,21 @@ public class testBrowserProvider extends
     private String mCombinedHistoryIdCol;
     private String mCombinedUrlCol;
     private String mCombinedTitleCol;
     private String mCombinedVisitsCol;
     private String mCombinedLastVisitedCol;
     private String mCombinedFaviconCol;
     private String mCombinedThumbnailCol;
 
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     private void loadContractInfo() throws Exception {
         mBookmarksUri = getContentUri("Bookmarks");
         mHistoryUri = getContentUri("History");
         mImagesUri = getContentUri("Images");
         mCombinedUri = getContentUri("Combined");
 
         mBookmarksPositionUri = getUriColumn("Bookmarks", "POSITIONS_CONTENT_URI");
 
@@ -296,18 +301,16 @@ public class testBrowserProvider extends
         mTests.add(new TestUpdateHistory());
         mTests.add(new TestUpdateHistoryImages());
         mTests.add(new TestUpdateOrInsertHistory());
 
         mTests.add(new TestCombinedView());
     }
 
     public void testBrowserProvider() throws Exception {
-        setTestType("mochitest");
-
         loadMobileFolderId();
 
         for (int i = 0; i < mTests.size(); i++) {
             Runnable test = mTests.get(i);
 
             setTestName(test.getClass().getSimpleName());
             ensureEmptyDatabase();
             test.run();
--- a/mobile/android/base/tests/testBrowserProviderPerf.java.in
+++ b/mobile/android/base/tests/testBrowserProviderPerf.java.in
@@ -53,16 +53,21 @@ public class testBrowserProviderPerf ext
 
     private String mHistoryTitleCol;
     private String mHistoryUrlCol;
     private String mHistoryVisitsCol;
     private String mHistoryFaviconCol;
     private String mHistoryThumbnailCol;
     private String mHistoryLastVisitedCol;
 
+    @Override
+    protected int getTestType() {
+        return TEST_TALOS;
+    }
+
     private void loadFilterMethod() throws Exception {
         Class browserDBClass = mClassLoader.loadClass("org.mozilla.gecko.db.BrowserDB");
 
         mFilterMethod =
             browserDBClass.getDeclaredMethod("filter", ContentResolver.class,
                                              CharSequence.class, int.class);
     }
 
@@ -219,18 +224,16 @@ public class testBrowserProviderPerf ext
 
         mGenerator = new Random(19580427);
 
         loadContractInfo();
         loadFilterMethod();
     }
 
     public void testBrowserProviderPerf() throws Exception {
-        setTestType("talos");
-
         loadMobileFolderId();
         addTonsOfUrls();
 
         long start = SystemClock.uptimeMillis();
 
         Cursor c = (Cursor) mFilterMethod.invoke(null, mResolver, KNOWN_PREFIX, 100);
         c.getCount(); // ensure query is not lazy loaded
 
--- a/mobile/android/base/tests/testCheck.java.in
+++ b/mobile/android/base/tests/testCheck.java.in
@@ -7,18 +7,22 @@ public class testCheck extends PixelTest
     private void pause(int length) {
         try {
             Thread.sleep(length);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
     }
 
+    @Override
+    protected int getTestType() {
+        return TEST_TALOS;
+    }
+
     public void testCheck() {
-        setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/timecube.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         loadAndPaint(url);
 
         mDriver.setupScrollHandling();
 
--- a/mobile/android/base/tests/testCheck2.java.in
+++ b/mobile/android/base/tests/testCheck2.java.in
@@ -1,16 +1,20 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
 public class testCheck2 extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_TALOS;
+    }
+
     public void testCheck2() {
-        setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/cnn/cnn.com/index.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
         loadAndPaint(url);
         mDriver.setupScrollHandling();
 
         /*
          * for this test, we load the timecube page, and replay a recorded sequence of events
--- a/mobile/android/base/tests/testCheck3.java.in
+++ b/mobile/android/base/tests/testCheck3.java.in
@@ -1,17 +1,21 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 import java.lang.reflect.Method;
 
 public class testCheck3 extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_TALOS;
+    }
+
     public void testCheck3() {
-        setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/cnn/cnn.com/index.html");
         // Disable Fennec's low-res screenshot for the duration of this test;
         // this distinguishes this test from testCheck2, which is otherwise
         // identical.
         disableScreenshot();
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
         loadAndPaint(url);
--- a/mobile/android/base/tests/testFlingCorrectness.java.in
+++ b/mobile/android/base/tests/testFlingCorrectness.java.in
@@ -6,18 +6,22 @@ import android.app.Instrumentation;
 
 /**
  * Basic fling correctness test.
  * - Loads a page and verifies it draws
  * - Drags page upwards by 200 pixels to get ready for a fling
  * - Fling the page downwards so we get back to the top and verify.
  */
 public class testFlingCorrectness extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testFlingCorrectness() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
--- a/mobile/android/base/tests/testFormHistory.java.in
+++ b/mobile/android/base/tests/testFormHistory.java.in
@@ -16,18 +16,23 @@ import java.util.ArrayList;
  * A basic form history contentprovider test.
  * - inserts an element in form history when it is not yet set up
  * - inserts an element in form history
  * - updates an element in form history
  * - deletes an element in form history
  */
 public class testFormHistory extends BaseTest {
     private static final String DB_NAME = "formhistory.sqlite";
+
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testFormHistory() {
-        setTestType("mochitest");
         Context context = (Context)getActivity();
         ContentResolver cr = context.getContentResolver();
         ContentValues[] cvs = new ContentValues[1];
         cvs[0] = new ContentValues();
   
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("Gecko:Ready");
         contentEventExpecter.blockForEvent();
   
--- a/mobile/android/base/tests/testJarReader.java.in
+++ b/mobile/android/base/tests/testJarReader.java.in
@@ -14,18 +14,22 @@ import java.io.ByteArrayInputStream;
 import java.lang.reflect.Method;
 import java.io.StringWriter;
 
 /**
  * A basic jar reader test. Tests reading a png from fennec's apk, as well
  * as loading some invalid jar urls.
  */
 public class testJarReader extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testJarReader() {
-        setTestType("mochitest");
         try {
             ClassLoader classLoader = getActivity().getClassLoader();
             Class gjrClass = classLoader.loadClass("org.mozilla.gecko.GeckoJarReader");
             Method getStreamMethod = gjrClass.getMethod("getStream", String.class);
             String appPath = getActivity().getApplication().getPackageResourcePath();
 
             // Test reading a file from a jar url
             String url = "jar:file://" + getActivity().getApplication().getPackageResourcePath() + "!/omni.ja";
--- a/mobile/android/base/tests/testLoad.java.in
+++ b/mobile/android/base/tests/testLoad.java.in
@@ -5,18 +5,22 @@ import @ANDROID_PACKAGE_NAME@.*;
 
 /**
  * A basic page load test.
  * - loads a page
  * - verifies it rendered properly
  * - verifies the displayed url is correct
  */
 public class testLoad extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testLoad() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         loadAndVerifyBoxes(url);
 
         verifyUrl(url);
     }
--- a/mobile/android/base/tests/testNewTab.java.in
+++ b/mobile/android/base/tests/testNewTab.java.in
@@ -1,17 +1,21 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Activity;
 
 public class testNewTab extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testNewTab() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         String url2 = getAbsoluteUrl("/robocop/robocop_blank_02.html");
         String tabCountText = null;
         String urlbarText = null;
         Activity activity = null;
         Element urlbar = null;
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
--- a/mobile/android/base/tests/testOverscroll.java.in
+++ b/mobile/android/base/tests/testOverscroll.java.in
@@ -6,18 +6,22 @@ import android.app.Instrumentation;
 
 /**
  * Basic test to check bounce-back from overscroll.
  * - Load the page and verify it draws
  * - Drag page downwards by 100 pixels into overscroll, verify it snaps back.
  * - Drag page rightwards by 100 pixels into overscroll, verify it snaps back.
  */
 public class testOverscroll extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testOverscroll() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
--- a/mobile/android/base/tests/testPan.java.in
+++ b/mobile/android/base/tests/testPan.java.in
@@ -4,19 +4,22 @@ package @ANDROID_PACKAGE_NAME@.tests;
 import @ANDROID_PACKAGE_NAME@.*;
 
 /**
  * A panning performance test.
  * Drags the page a bunch of times and measures the frames per second
  * that fennec draws at.
  */
 public class testPan extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_TALOS;
+    }
 
     public void testPan() {
-        setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         loadAndPaint(url);
 
         mDriver.setupScrollHandling();
 
--- a/mobile/android/base/tests/testPanCorrectness.java.in
+++ b/mobile/android/base/tests/testPanCorrectness.java.in
@@ -6,18 +6,22 @@ import android.app.Instrumentation;
 
 /**
  * A basic panning correctness test.
  * - Loads a page and verifies it draws
  * - drags page upwards by 100 pixels and verifies it draws
  * - drags page leftwards by 100 pixels and verifies it draws
  */
 public class testPanCorrectness extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testPanCorrectness() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
--- a/mobile/android/base/tests/testPasswordEncrypt.java.in
+++ b/mobile/android/base/tests/testPasswordEncrypt.java.in
@@ -11,18 +11,22 @@ import android.net.Uri;
 import java.io.File;
 import java.lang.reflect.Method;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 public class testPasswordEncrypt extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testPasswordEncrypt() {
-      setTestType("mochitest");
       Context context = (Context)getActivity();
       ContentResolver cr = context.getContentResolver();
       mAsserter.isnot(cr, null, "Found a content resolver");
       ContentValues cvs = new ContentValues();
 
       Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("Gecko:Ready");
       contentEventExpecter.blockForEvent();
 
--- a/mobile/android/base/tests/testPasswordProvider.java.in
+++ b/mobile/android/base/tests/testPasswordProvider.java.in
@@ -14,18 +14,23 @@ import java.io.File;
  * A basic password contentprovider test.
  * - inserts a password when the database is not yet set up
  * - inserts a password
  * - updates a password
  * - deletes a password
  */
 public class testPasswordProvider extends BaseTest {
     private static final String DB_NAME = "signons.sqlite";
+
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testPasswordProvider() {
-        setTestType("mochitest");
         Context context = (Context)getActivity();
         ContentResolver cr = context.getContentResolver();
         ContentValues[] cvs = new ContentValues[1];
         cvs[0] = new ContentValues();
   
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("Gecko:Ready");
         contentEventExpecter.blockForEvent();
   
--- a/mobile/android/base/tests/testPermissions.java.in
+++ b/mobile/android/base/tests/testPermissions.java.in
@@ -5,18 +5,22 @@ import @ANDROID_PACKAGE_NAME@.*;
 
 import android.widget.CheckBox;
 import java.util.ArrayList;
 
 public class testPermissions extends PixelTest {
     private PaintedSurface mPaintedSurface;
     private Actions.RepeatedEventExpecter mPaintExpecter;
 
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testPermissions() {
-        setTestType("mochitest");
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         geolocationTest();
     }
 
     private void geolocationTest() {
         // Test geolocation notification
         mPaintedSurface = loadAndPaint(getAbsoluteUrl("/robocop/robocop_geolocation.html"));
--- a/mobile/android/base/tests/testWebContentContextMenu.java.in
+++ b/mobile/android/base/tests/testWebContentContextMenu.java.in
@@ -1,18 +1,22 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Activity;
 import android.util.DisplayMetrics;
 
 public class testWebContentContextMenu extends BaseTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void testWebContentContextMenu() {
-        setTestType("mochitest");
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         DisplayMetrics dm = new DisplayMetrics();
         getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
 
         // The link has a 60px height, so let's try to hit the middle
         float top = mDriver.getGeckoTop() + 30 * dm.density;
         float left = mDriver.getGeckoLeft() + mDriver.getGeckoWidth() / 2;
--- a/mobile/android/base/tests/test_bug720538.java.in
+++ b/mobile/android/base/tests/test_bug720538.java.in
@@ -1,17 +1,21 @@
 #filter substitution
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Instrumentation;
 
 public class test_bug720538 extends PixelTest {
+    @Override
+    protected int getTestType() {
+        return TEST_MOCHITEST;
+    }
+
     public void test_bug720538() {
-        setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/test_bug720538.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         /*
          * for this test, we load the associated test_bug720538.html file. this file has two
          * iframes (painted completely blue - #0000FF) and the rest of the page is the background
          * color, which is #008000 green. When we first render the page there is an iframe in