diff --git a/tests/DumpRenderTree2/AndroidManifest.xml b/tests/DumpRenderTree2/AndroidManifest.xml
index 14df611..1213674 100644
--- a/tests/DumpRenderTree2/AndroidManifest.xml
+++ b/tests/DumpRenderTree2/AndroidManifest.xml
@@ -25,13 +25,13 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".LayoutTestsRunner"
-                  android:label="Layout tests' runner">
+        <activity android:name=".TestsListActivity"
+                  android:label="Tests' list activity">
         </activity>
 
-        <activity android:name=".LayoutTestsExecuter"
-                  android:label="Layout tests' executer"
-                  android:process=":executer">
+        <activity android:name=".LayoutTestsExecutor"
+                  android:label="Layout tests' executor"
+                  android:process=":executor">
         </activity>
 
         <service android:name="ManagerService">
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
index 3c7dee2..0a80ed4 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/AbstractResult.java
@@ -27,8 +27,21 @@
 public abstract class AbstractResult {
 
     public enum TestType {
-        TEXT,
-        PIXEL
+        TEXT {
+            @Override
+            public AbstractResult createResult(Bundle bundle) {
+                return new TextResult(bundle);
+            }
+        },
+        RENDER_TREE {
+            @Override
+            public AbstractResult createResult(Bundle bundle) {
+                /** TODO: RenderTree tests are not yet supported */
+                return null;
+            }
+        };
+
+        public abstract AbstractResult createResult(Bundle bundle);
     }
 
     public enum ResultCode {
@@ -101,6 +114,8 @@
      */
     public abstract TestType getType();
 
+    public abstract String getRelativePath();
+
     /**
      * Returns a piece of HTML code that presents a visual diff between a result and
      * the expected result.
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTest.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTest.java
deleted file mode 100644
index 1312ef9..0000000
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dumprendertree2;
-
-import android.app.Activity;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Message;
-import android.webkit.JsPromptResult;
-import android.webkit.JsResult;
-import android.webkit.WebChromeClient;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-import android.webkit.WebStorage.QuotaUpdater;
-
-import java.io.File;
-
-/**
- * A class that represents a single layout test. It is responsible for running the test,
- * checking its result and creating an AbstractResult object.
- */
-public class LayoutTest {
-
-    private static final String LOG_TAG = "LayoutTest";
-
-    public static final int MSG_ACTUAL_RESULT_OBTAINED = 0;
-
-    private String mRelativePath;
-    private String mTestsRootDirPath;
-    private String mUrl;
-    private boolean mOnTestFinishedCalled;
-    private Message mTestFinishedMsg;
-    private AbstractResult mResult;
-
-    private WebView mWebView;
-    private Activity mActivity;
-
-    private final Handler mResultHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            if (msg.what == MSG_ACTUAL_RESULT_OBTAINED) {
-                mResult.setExpectedTextResult(LayoutTestsRunnerThread
-                        .getExpectedTextResult(mRelativePath));
-                mResult.setExpectedImageResult(LayoutTestsRunnerThread
-                        .getExpectedImageResult(mRelativePath));
-                mTestFinishedMsg.sendToTarget();
-            }
-        }
-    };
-
-    private WebViewClient mWebViewClient = new WebViewClient() {
-        @Override
-        public void onPageFinished(WebView view, String url) {
-            /** Some tests fire up many page loads, we don't want to detect them */
-            if (!url.equals(mUrl)) {
-                return;
-            }
-
-            onTestFinished();
-        }
-    };
-
-    private WebChromeClient mWebChromeClient = new WebChromeClient() {
-        @Override
-        public void onExceededDatabaseQuota(String url, String databaseIdentifier,
-                long currentQuota, long estimatedSize, long totalUsedQuota,
-                QuotaUpdater quotaUpdater) {
-            /** TODO: This should be recorded as part of the text result */
-            quotaUpdater.updateQuota(currentQuota + 5 * 1024 * 1024);
-        }
-
-        @Override
-        public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
-            /** TODO: Alerts should be recorded as part of text result */
-            result.confirm();
-            return true;
-        }
-
-        @Override
-        public boolean onJsConfirm(WebView view, String url, String message, JsResult result) {
-            /** TODO: Alerts should be recorded as part of text result */
-            result.confirm();
-            return true;
-        }
-
-        @Override
-        public boolean onJsPrompt(WebView view, String url, String message, String defaultValue,
-                JsPromptResult result) {
-            /** TODO: Alerts should be recorded as part of text result */
-            result.confirm();
-            return true;
-        }
-
-    };
-
-    public LayoutTest(String relativePath, String testsRootDirPath, Message testFinishedMsg,
-            LayoutTestsRunner activity) {
-        mRelativePath = relativePath;
-        mTestsRootDirPath = testsRootDirPath;
-        mTestFinishedMsg = testFinishedMsg;
-        mActivity = activity;
-    }
-
-    public LayoutTest(AbstractResult result, String relativePath) {
-        mResult = result;
-        mRelativePath = relativePath;
-    }
-
-    public void run() {
-        mWebView = new WebView(mActivity);
-        mActivity.setContentView(mWebView);
-
-        setupWebView();
-
-        /** TODO: Add timeout msg */
-        mUrl = Uri.fromFile(new File(mTestsRootDirPath, mRelativePath)).toString();
-        mWebView.loadUrl(mUrl);
-    }
-
-    private void onTestFinished() {
-        if (mOnTestFinishedCalled) {
-            return;
-        }
-
-        mOnTestFinishedCalled = true;
-
-        /**
-         * If the result has not been set by the time the test finishes we create
-         * a default type of result.
-         */
-        if (mResult == null) {
-            /** TODO: Default type should be RenderTreeResult. We don't support it now. */
-            mResult = new TextResult(mRelativePath);
-        }
-
-        /** TODO: Implement waitUntilDone */
-
-        mResult.obtainActualResults(mWebView,
-                mResultHandler.obtainMessage(MSG_ACTUAL_RESULT_OBTAINED));
-    }
-
-    private void setupWebView() {
-        WebSettings webViewSettings = mWebView.getSettings();
-        webViewSettings.setAppCacheEnabled(true);
-        webViewSettings.setAppCachePath(mActivity.getApplicationContext().getCacheDir().getPath());
-        webViewSettings.setAppCacheMaxSize(Long.MAX_VALUE);
-        webViewSettings.setJavaScriptEnabled(true);
-        webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
-        webViewSettings.setSupportMultipleWindows(true);
-        webViewSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
-        webViewSettings.setDatabaseEnabled(true);
-        webViewSettings.setDatabasePath(mActivity.getDir("databases", 0).getAbsolutePath());
-        webViewSettings.setDomStorageEnabled(true);
-        webViewSettings.setWorkersEnabled(false);
-        webViewSettings.setXSSAuditorEnabled(false);
-
-        mWebView.setWebViewClient(mWebViewClient);
-        mWebView.setWebChromeClient(mWebChromeClient);
-    }
-
-    public AbstractResult getResult() {
-        return mResult;
-    }
-
-    public String getRelativePath() {
-        return mRelativePath;
-    }
-}
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecuter.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
similarity index 84%
rename from tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecuter.java
rename to tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
index 6fd3085..608b14e4 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecuter.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java
@@ -30,6 +30,7 @@
 import android.os.Messenger;
 import android.os.RemoteException;
 import android.util.Log;
+import android.view.Window;
 import android.webkit.JsPromptResult;
 import android.webkit.JsResult;
 import android.webkit.WebChromeClient;
@@ -47,7 +48,7 @@
  * to ManagerService. The reason why is to handle crashing (test that crashes brings down
  * whole process with it).
  */
-public class LayoutTestsExecuter extends Activity {
+public class LayoutTestsExecutor extends Activity {
 
     /** TODO: make it a setting */
     static final String TESTS_ROOT_DIR_PATH =
@@ -55,14 +56,23 @@
             File.separator + "android" +
             File.separator + "LayoutTests";
 
-    private static final String LOG_TAG = "LayoutTestExecuter";
+    private static final String LOG_TAG = "LayoutTestExecutor";
 
     public static final String EXTRA_TESTS_LIST = "TestsList";
+    public static final String EXTRA_TEST_INDEX = "TestIndex";
 
     private static final int MSG_ACTUAL_RESULT_OBTAINED = 0;
 
     private List<String> mTestsList;
-    private int mCurrentTestCount = 0;
+
+    /**
+     * This is a number of currently running test. It is 0-based and doesn't reset after
+     * the crash. Initial index is passed to LayoutTestsExecuter in the intent that starts
+     * it.
+     */
+    private int mCurrentTestIndex;
+
+    private int mTotalTestCount;
 
     private WebView mCurrentWebView;
     private String mCurrentTestRelativePath;
@@ -94,6 +104,8 @@
         public void handleMessage(Message msg) {
             if (msg.what == MSG_ACTUAL_RESULT_OBTAINED) {
                 reportResultToService();
+                mCurrentTestIndex++;
+                updateProgressBar();
                 runNextTest();
             }
         }
@@ -153,8 +165,12 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        requestWindowFeature(Window.FEATURE_PROGRESS);
+
         Intent intent = getIntent();
         mTestsList = intent.getStringArrayListExtra(EXTRA_TESTS_LIST);
+        mCurrentTestIndex = intent.getIntExtra(EXTRA_TEST_INDEX, -1);
+        mTotalTestCount = mCurrentTestIndex + mTestsList.size();
 
         bindService(new Intent(this, ManagerService.class), mServiceConnection,
                 Context.BIND_AUTO_CREATE);
@@ -191,7 +207,6 @@
             return;
         }
 
-        mCurrentTestCount++;
         mCurrentTestRelativePath = mTestsList.remove(0);
         mCurrentTestUri =
                 Uri.fromFile(new File(TESTS_ROOT_DIR_PATH, mCurrentTestRelativePath)).toString();
@@ -226,6 +241,7 @@
             Message serviceMsg =
                     Message.obtain(null, ManagerService.MSG_PROCESS_ACTUAL_RESULTS);
             Bundle bundle = mCurrentResult.getBundle();
+            bundle.putInt("testIndex", mCurrentTestIndex);
             /** TODO: Add timeout info to bundle */
             serviceMsg.setData(bundle);
             mManagerServiceMessenger.send(serviceMsg);
@@ -234,7 +250,20 @@
         }
     }
 
+    private void updateProgressBar() {
+        getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
+                mCurrentTestIndex * Window.PROGRESS_END / mTotalTestCount);
+        setTitle(mCurrentTestIndex * 100 / mTotalTestCount + "% " +
+                "(" + mCurrentTestIndex + "/" + mTotalTestCount + ")");
+    }
+
     private void onAllTestsFinished() {
-        Log.d(LOG_TAG + "::onAllTestsFisnihed", "Begin.");
+        try {
+            Message serviceMsg =
+                    Message.obtain(null, ManagerService.MSG_ALL_TESTS_FINISHED);
+            mManagerServiceMessenger.send(serviceMsg);
+        } catch (RemoteException e) {
+            Log.e(LOG_TAG + "::onAllTestsFinished", e.getMessage());
+        }
     }
 }
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunner.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunner.java
deleted file mode 100644
index 4421aba..0000000
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunner.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dumprendertree2;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.view.Window;
-
-/**
- * An Activity that is responsible only for updating the UI features, like titles, progress bars,
- * etc.
- *
- * <p>Also, the webview form the test must be running in this activity's thread if we want
- * to be able to display it on the screen.
- */
-public class LayoutTestsRunner extends Activity {
-
-    public static final int MSG_UPDATE_PROGRESS = 1;
-    public static final int MSG_SHOW_PROGRESS_DIALOG = 2;
-    public static final int MSG_DISMISS_PROGRESS_DIALOG = 3;
-
-    /** Constants for adding extras to an intent */
-    public static final String EXTRA_TEST_PATH = "TestPath";
-
-    private static ProgressDialog sProgressDialog;
-
-    private Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case MSG_UPDATE_PROGRESS:
-                    int i = msg.arg1;
-                    int size = msg.arg2;
-                    getWindow().setFeatureInt(Window.FEATURE_PROGRESS,
-                            i * Window.PROGRESS_END / size);
-                    setTitle(i * 100 / size + "% (" + i + "/" + size + ")");
-                    break;
-
-                case MSG_SHOW_PROGRESS_DIALOG:
-                    sProgressDialog.show();
-                    break;
-
-                case MSG_DISMISS_PROGRESS_DIALOG:
-                    sProgressDialog.dismiss();
-                    break;
-            }
-        }
-    };
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        /** Prepare the progress dialog */
-        sProgressDialog = new ProgressDialog(LayoutTestsRunner.this);
-        sProgressDialog.setCancelable(false);
-        sProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
-        sProgressDialog.setTitle(R.string.dialog_progress_title);
-        sProgressDialog.setMessage(getText(R.string.dialog_progress_msg));
-
-        requestWindowFeature(Window.FEATURE_PROGRESS);
-
-        /** Execute the intent */
-        Intent intent = getIntent();
-        if (!intent.getAction().equals(Intent.ACTION_RUN)) {
-            return;
-        }
-        String path = intent.getStringExtra(EXTRA_TEST_PATH);
-
-        new LayoutTestsRunnerThread(path, this).start();
-    }
-
-    public Handler getHandler() {
-        return mHandler;
-    }
-}
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunnerThread.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunnerThread.java
deleted file mode 100644
index ac814cb..0000000
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsRunnerThread.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dumprendertree2;
-
-import android.content.Intent;
-import android.os.Environment;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.util.Log;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.LinkedList;
-
-/**
- * A Thread that is responsible for finding and loading the tests, starting them and
- * generating summaries. The actual running of the test is delegated to LayoutTestsRunner
- * activity (a UI thread) because of a WebView object that need to be created in UI thread
- * so it can be displayed on the screen. However, the logic for doing this remains in
- * this class (in handler created in constructor).
- */
-public class LayoutTestsRunnerThread extends Thread {
-
-    private static final String LOG_TAG = "LayoutTestsRunnerThread";
-
-    /** Messages for handler on this thread */
-    public static final int MSG_TEST_FINISHED = 0;
-
-    /** Messages for our handler running on UI thread */
-    public static final int MSG_RUN_TEST = 0;
-
-    /** TODO: make it a setting */
-    private static final String TESTS_ROOT_DIR_PATH =
-            Environment.getExternalStorageDirectory() +
-            File.separator + "android" +
-            File.separator + "LayoutTests";
-
-    /** TODO: make it a setting */
-    private static final String RESULTS_ROOT_DIR_PATH =
-            Environment.getExternalStorageDirectory() +
-            File.separator + "android" +
-            File.separator + "LayoutTests-results";
-
-    /** TODO: Make it a setting */
-    private static final String EXPECTED_RESULT_SECONDARY_LOCATION_RELATIVE_DIR_PREFIX =
-            "platform" + File.separator +
-            "android-v8" + File.separator;
-
-    /** TODO: Make these settings */
-    private static final String TEXT_RESULT_EXTENSION = "txt";
-    private static final String IMAGE_RESULT_EXTENSION = "png";
-
-    /** A list containing relative paths of tests to run */
-    private LinkedList<String> mTestsList = new LinkedList<String>();
-
-    private FileFilter mFileFilter;
-    private Summarizer mSummarizer;
-
-    /** Our handler running on this thread. Created in run() method. */
-    private Handler mHandler;
-
-    /** Our handler running on UI thread. Created in constructor of this thread. */
-    private Handler mHandlerOnUiThread;
-
-    /**
-     * A relative path to the folder with the tests we want to run or particular test.
-     * Used up to and including preloadTests().
-     */
-    private String mRelativePath;
-
-    private LayoutTestsRunner mActivity;
-
-    private LayoutTest mCurrentTest;
-    private String mCurrentTestPath;
-    private int mCurrentTestCount = 0;
-    private int mTotalTestCount;
-
-    /**
-     * The given path must be relative to the root dir. The given handler must be
-     * able to handle messages that update the display (UI thread).
-     *
-     * @param path
-     * @param uiDisplayHandler
-     */
-    public LayoutTestsRunnerThread(String path, LayoutTestsRunner activity) {
-        mFileFilter = new FileFilter(TESTS_ROOT_DIR_PATH);
-        mRelativePath = path;
-        mActivity = activity;
-
-        /** This creates a handler that runs on the thread that _created_ this thread */
-        mHandlerOnUiThread = new Handler() {
-            @Override
-            public void handleMessage(Message msg) {
-                switch (msg.what) {
-                    case MSG_RUN_TEST:
-                        ((LayoutTest) msg.obj).run();
-                        break;
-                }
-            }
-        };
-    }
-
-    @Override
-    public void run() {
-        Looper.prepare();
-
-        mSummarizer = new Summarizer(mFileFilter, RESULTS_ROOT_DIR_PATH);
-
-        /** A handler obtained from UI thread to handle messages concerning updating the display */
-        final Handler uiDisplayHandler = mActivity.getHandler();
-
-        /** Creates a new handler in _this_ thread */
-        mHandler = new Handler() {
-            @Override
-            public void handleMessage(Message msg) {
-                switch (msg.what) {
-                    case MSG_TEST_FINISHED:
-                        onTestFinished(mCurrentTest);
-                        uiDisplayHandler.obtainMessage(LayoutTestsRunner.MSG_UPDATE_PROGRESS,
-                                mCurrentTestCount, mTotalTestCount).sendToTarget();
-                        runNextTest();
-                        break;
-                }
-            }
-        };
-
-        /** Check if the path is correct */
-        File file = new File(TESTS_ROOT_DIR_PATH, mRelativePath);
-        if (!file.exists()) {
-            Log.e(LOG_TAG + "::run", "Path does not exist: " + mRelativePath);
-            return;
-        }
-
-        /** Populate the tests' list accordingly */
-        if (file.isDirectory()) {
-            uiDisplayHandler.sendEmptyMessage(LayoutTestsRunner.MSG_SHOW_PROGRESS_DIALOG);
-            preloadTests(mRelativePath);
-            uiDisplayHandler.sendEmptyMessage(LayoutTestsRunner.MSG_DISMISS_PROGRESS_DIALOG);
-        } else {
-            mTestsList.addLast(mRelativePath);
-            mTotalTestCount = 1;
-        }
-
-        /**
-         * Instead of running next test here, we send a tests' list to Executer activity.
-         * Rest of the code is never executed and will be gradually moved to the service.
-         */
-        Intent intent = new Intent();
-        intent.setClass(mActivity, LayoutTestsExecuter.class);
-        intent.setAction(Intent.ACTION_RUN);
-        intent.putStringArrayListExtra(LayoutTestsExecuter.EXTRA_TESTS_LIST,
-                new ArrayList<String>(mTestsList));
-        mActivity.startActivity(intent);
-
-        Looper.loop();
-    }
-
-    /**
-     * Loads all the tests from the given folders and all the subfolders
-     * into mTestsList.
-     *
-     * @param dirRelativePath
-     */
-    private void preloadTests(String dirRelativePath) {
-        LinkedList<String> foldersList = new LinkedList<String>();
-        foldersList.add(dirRelativePath);
-
-        String relativePath;
-        String currentDirRelativePath;
-        String itemName;
-        File[] items;
-        while (!foldersList.isEmpty()) {
-            currentDirRelativePath = foldersList.removeFirst();
-            items = new File(TESTS_ROOT_DIR_PATH, currentDirRelativePath).listFiles();
-            for (File item : items) {
-                itemName = item.getName();
-                relativePath = currentDirRelativePath + File.separator + itemName;
-
-                if (item.isDirectory() && FileFilter.isTestDir(itemName)) {
-                    foldersList.add(relativePath);
-                    continue;
-                }
-
-                if (FileFilter.isTestFile(itemName)) {
-                    if (!mFileFilter.isSkip(relativePath)) {
-                        mTestsList.addLast(relativePath);
-                    } else {
-                        mSummarizer.addSkippedTest(relativePath);
-                    }
-                }
-            }
-        }
-
-        mTotalTestCount = mTestsList.size();
-    }
-
-    private void runNextTest() {
-        if (mTestsList.isEmpty()) {
-            onFinishedTests();
-            return;
-        }
-
-        mCurrentTestCount++;
-        mCurrentTestPath = mTestsList.removeFirst();
-        mCurrentTest = new LayoutTest(mCurrentTestPath, TESTS_ROOT_DIR_PATH,
-                mHandler.obtainMessage(MSG_TEST_FINISHED), mActivity);
-
-        /**
-         * This will run the test on UI thread. The reason why we need to run the test
-         * on UI thread is because of the WebView. If we want to display the webview on
-         * the screen it needs to be in the UI thread. WebView should be created as
-         * part of the LayoutTest.run() method.
-         */
-        mHandlerOnUiThread.obtainMessage(MSG_RUN_TEST, mCurrentTest).sendToTarget();
-    }
-
-    private void onTestFinished(LayoutTest test) {
-        String testPath = test.getRelativePath();
-
-        /** Obtain the result */
-        AbstractResult result = test.getResult();
-        if (result == null) {
-            Log.e(LOG_TAG + "::runTests", testPath + ": result NULL!!");
-            return;
-        }
-
-        dumpResultData(result, testPath);
-
-        mSummarizer.appendTest(test);
-    }
-
-    private void dumpResultData(AbstractResult result, String testPath) {
-        dumpActualTextResult(result, testPath);
-        dumpActualImageResult(result, testPath);
-    }
-
-    private void dumpActualTextResult(AbstractResult result, String testPath) {
-        String actualTextResult = result.getActualTextResult();
-        if (actualTextResult == null) {
-            return;
-        }
-
-        String resultPath = FileFilter.setPathEnding(testPath, "-actual." + TEXT_RESULT_EXTENSION);
-        FsUtils.writeDataToStorage(new File(RESULTS_ROOT_DIR_PATH, resultPath),
-                actualTextResult.getBytes(), false);
-    }
-
-    private void dumpActualImageResult(AbstractResult result, String testPath) {
-        byte[] actualImageResult = result.getActualImageResult();
-        if (actualImageResult == null) {
-            return;
-        }
-
-        String resultPath = FileFilter.setPathEnding(testPath, "-actual." + IMAGE_RESULT_EXTENSION);
-        FsUtils.writeDataToStorage(new File(RESULTS_ROOT_DIR_PATH, resultPath),
-                actualImageResult, false);
-    }
-
-    private void onFinishedTests() {
-        Log.d(LOG_TAG + "::onFinishedTests", "Begin.");
-        Looper.myLooper().quit();
-        mSummarizer.summarize();
-        /** TODO: Present some kind of notification to the user that
-         * allows to chose next action, e.g:
-         * - go to html view of results
-         * - zip results
-         * - run more tests before zipping */
-    }
-
-    public static String getExpectedTextResult(String relativePath) {
-        return new String(getExpectedResult(relativePath, TEXT_RESULT_EXTENSION));
-    }
-
-    public static byte[] getExpectedImageResult(String relativePath) {
-        return getExpectedResult(relativePath, IMAGE_RESULT_EXTENSION);
-    }
-
-    private static byte[] getExpectedResult(String relativePath, String extension) {
-        relativePath = FileFilter.setPathEnding(relativePath, "-expected." + extension);
-
-        byte[] bytes = FsUtils.readDataFromStorage(new File(TESTS_ROOT_DIR_PATH, relativePath));
-        if (bytes == null) {
-            relativePath = EXPECTED_RESULT_SECONDARY_LOCATION_RELATIVE_DIR_PREFIX + relativePath;
-            bytes = FsUtils.readDataFromStorage(new File(TESTS_ROOT_DIR_PATH, relativePath));
-        }
-
-        return bytes;
-    }
-}
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
index e452a38..e32247c 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ManagerService.java
@@ -18,12 +18,16 @@
 
 import android.app.Service;
 import android.content.Intent;
+import android.os.Bundle;
+import android.os.Environment;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
 import android.os.Messenger;
 import android.util.Log;
 
+import java.io.File;
+
 /**
  * A service that handles managing the results of tests, informing of crashes, generating
  * summaries, etc.
@@ -32,7 +36,29 @@
 
     private static final String LOG_TAG = "ManagerService";
 
+    /** TODO: make it a setting */
+    static final String TESTS_ROOT_DIR_PATH =
+            Environment.getExternalStorageDirectory() +
+            File.separator + "android" +
+            File.separator + "LayoutTests";
+
+    /** TODO: make it a setting */
+    static final String RESULTS_ROOT_DIR_PATH =
+            Environment.getExternalStorageDirectory() +
+            File.separator + "android" +
+            File.separator + "LayoutTests-results";
+
+    /** TODO: Make it a setting */
+    private static final String EXPECTED_RESULT_SECONDARY_LOCATION_RELATIVE_DIR_PREFIX =
+            "platform" + File.separator +
+            "android-v8" + File.separator;
+
+    /** TODO: Make these settings */
+    private static final String TEXT_RESULT_EXTENSION = "txt";
+    private static final String IMAGE_RESULT_EXTENSION = "png";
+
     static final int MSG_PROCESS_ACTUAL_RESULTS = 0;
+    static final int MSG_ALL_TESTS_FINISHED = 1;
 
     private Handler mIncomingHandler = new Handler() {
         @Override
@@ -40,6 +66,11 @@
             switch (msg.what) {
                 case MSG_PROCESS_ACTUAL_RESULTS:
                     Log.d(LOG_TAG + ".mIncomingHandler", msg.getData().getString("relativePath"));
+                    onActualResultsObtained(msg.getData());
+                    break;
+
+                case MSG_ALL_TESTS_FINISHED:
+                    mSummarizer.summarize();
                     break;
             }
         }
@@ -47,14 +78,76 @@
 
     private Messenger mMessenger = new Messenger(mIncomingHandler);
 
+    private FileFilter mFileFilter;
+    private Summarizer mSummarizer;
+
     @Override
     public void onCreate() {
         super.onCreate();
-        /** TODO:  */
+
+        mFileFilter = new FileFilter(TESTS_ROOT_DIR_PATH);
+        mSummarizer = new Summarizer(mFileFilter, RESULTS_ROOT_DIR_PATH);
     }
 
     @Override
     public IBinder onBind(Intent intent) {
         return mMessenger.getBinder();
     }
+
+    private void onActualResultsObtained(Bundle bundle) {
+        AbstractResult results =
+                AbstractResult.TestType.valueOf(bundle.getString("type")).createResult(bundle);
+        String relativePath = results.getRelativePath();
+        results.setExpectedTextResult(getExpectedTextResult(relativePath));
+        results.setExpectedImageResult(getExpectedImageResult(relativePath));
+
+        dumpActualTextResult(results);
+        dumpActualImageResult(results);
+
+        mSummarizer.appendTest(results);
+    }
+
+    private void dumpActualTextResult(AbstractResult result) {
+        String testPath = result.getRelativePath();
+        String actualTextResult = result.getActualTextResult();
+        if (actualTextResult == null) {
+            return;
+        }
+
+        String resultPath = FileFilter.setPathEnding(testPath, "-actual." + TEXT_RESULT_EXTENSION);
+        FsUtils.writeDataToStorage(new File(RESULTS_ROOT_DIR_PATH, resultPath),
+                actualTextResult.getBytes(), false);
+    }
+
+    private void dumpActualImageResult(AbstractResult result) {
+        String testPath = result.getRelativePath();
+        byte[] actualImageResult = result.getActualImageResult();
+        if (actualImageResult == null) {
+            return;
+        }
+
+        String resultPath = FileFilter.setPathEnding(testPath, "-actual." + IMAGE_RESULT_EXTENSION);
+        FsUtils.writeDataToStorage(new File(RESULTS_ROOT_DIR_PATH, resultPath),
+                actualImageResult, false);
+    }
+
+    public static String getExpectedTextResult(String relativePath) {
+        return new String(getExpectedResult(relativePath, TEXT_RESULT_EXTENSION));
+    }
+
+    public static byte[] getExpectedImageResult(String relativePath) {
+        return getExpectedResult(relativePath, IMAGE_RESULT_EXTENSION);
+    }
+
+    private static byte[] getExpectedResult(String relativePath, String extension) {
+        relativePath = FileFilter.setPathEnding(relativePath, "-expected." + extension);
+
+        byte[] bytes = FsUtils.readDataFromStorage(new File(TESTS_ROOT_DIR_PATH, relativePath));
+        if (bytes == null) {
+            relativePath = EXPECTED_RESULT_SECONDARY_LOCATION_RELATIVE_DIR_PREFIX + relativePath;
+            bytes = FsUtils.readDataFromStorage(new File(TESTS_ROOT_DIR_PATH, relativePath));
+        }
+
+        return bytes;
+    }
 }
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
index 4d15bb5..36cde86 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/Summarizer.java
@@ -16,8 +16,6 @@
 
 package com.android.dumprendertree2;
 
-import android.util.Log;
-
 import java.io.File;
 import java.util.EnumMap;
 import java.util.HashSet;
@@ -155,15 +153,8 @@
         mSkippedTestsList.addLast(relativePath);
     }
 
-    public void appendTest(LayoutTest test) {
-        String testPath = test.getRelativePath();
-
-        /** Obtain the result */
-        AbstractResult result = test.getResult();
-        if (result == null) {
-            Log.e(LOG_TAG + "::appendTest", testPath + ": result NULL!!");
-            return;
-        }
+    public void appendTest(AbstractResult result) {
+        String testPath = result.getRelativePath();
 
         AbstractResult.ResultCode resultCode = result.getResultCode();
 
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
new file mode 100644
index 0000000..a402ae1
--- /dev/null
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListActivity.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dumprendertree2;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.Window;
+
+import java.util.ArrayList;
+
+/**
+ * An Activity that generates a list of tests and sends the intent to
+ * LayoutTestsExecuter to run them. It also restarts the LayoutTestsExecuter
+ * after it crashes (TODO).
+ */
+public class TestsListActivity extends Activity {
+
+    private static final int MSG_TEST_LIST_PRELOADER_DONE = 0;
+
+    /** Constants for adding extras to an intent */
+    public static final String EXTRA_TEST_PATH = "TestPath";
+
+    private static ProgressDialog sProgressDialog;
+
+    private Handler mHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MSG_TEST_LIST_PRELOADER_DONE:
+                    sProgressDialog.dismiss();
+                    mTestsList = (ArrayList<String>)msg.obj;
+                    mTotalTestCount = mTestsList.size();
+                    restartExecutor(0);
+                    break;
+            }
+        }
+    };
+
+    private ArrayList<String> mTestsList;
+    private int mTotalTestCount;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        /** Prepare the progress dialog */
+        sProgressDialog = new ProgressDialog(TestsListActivity.this);
+        sProgressDialog.setCancelable(false);
+        sProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+        sProgressDialog.setTitle(R.string.dialog_progress_title);
+        sProgressDialog.setMessage(getText(R.string.dialog_progress_msg));
+
+        requestWindowFeature(Window.FEATURE_PROGRESS);
+
+        Intent intent = getIntent();
+        if (!intent.getAction().equals(Intent.ACTION_RUN)) {
+            return;
+        }
+        String path = intent.getStringExtra(EXTRA_TEST_PATH);
+
+        sProgressDialog.show();
+        Message doneMsg = Message.obtain(mHandler, MSG_TEST_LIST_PRELOADER_DONE);
+
+        new TestsListPreloaderThread(path, doneMsg).start();
+    }
+
+    /**
+     * (Re)starts the executer activity from the given test number (inclusive, 0-based).
+     * This number is an index in mTestsList, not the sublist passed in the intent.
+     *
+     * @param startFrom
+     *      test index in mTestsList to start the tests from (inclusive, 0-based)
+     */
+    private void restartExecutor(int startFrom) {
+        Intent intent = new Intent();
+        intent.setClass(this, LayoutTestsExecutor.class);
+        intent.setAction(Intent.ACTION_RUN);
+        intent.putStringArrayListExtra(LayoutTestsExecutor.EXTRA_TESTS_LIST,
+                new ArrayList<String>(mTestsList.subList(startFrom, mTotalTestCount)));
+        intent.putExtra(LayoutTestsExecutor.EXTRA_TEST_INDEX, startFrom);
+        startActivity(intent);
+    }
+}
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java
new file mode 100644
index 0000000..f76105d
--- /dev/null
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TestsListPreloaderThread.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.dumprendertree2;
+
+import android.os.Environment;
+import android.os.Message;
+import android.util.Log;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+/**
+ * A Thread that is responsible for generating a lists of tests to run.
+ */
+public class TestsListPreloaderThread extends Thread {
+
+    private static final String LOG_TAG = "TestsListPreloaderThread";
+
+    /** TODO: make it a setting */
+    private static final String TESTS_ROOT_DIR_PATH =
+            Environment.getExternalStorageDirectory() +
+            File.separator + "android" +
+            File.separator + "LayoutTests";
+
+    /** A list containing relative paths of tests to run */
+    private ArrayList<String> mTestsList = new ArrayList<String>();
+
+    private FileFilter mFileFilter;
+
+    /**
+     * A relative path to the folder with the tests we want to run or particular test.
+     * Used up to and including preloadTests().
+     */
+    private String mRelativePath;
+
+    private Message mDoneMsg;
+
+    /**
+     * The given path must be relative to the root dir.
+     *
+     * @param path
+     * @param doneMsg
+     */
+    public TestsListPreloaderThread(String path, Message doneMsg) {
+        mFileFilter = new FileFilter(TESTS_ROOT_DIR_PATH);
+        mRelativePath = path;
+        mDoneMsg = doneMsg;
+    }
+
+    @Override
+    public void run() {
+        /** Check if the path is correct */
+        File file = new File(TESTS_ROOT_DIR_PATH, mRelativePath);
+        if (!file.exists()) {
+            Log.e(LOG_TAG + "::run", "Path does not exist: " + mRelativePath);
+            return;
+        }
+
+        /** Populate the tests' list accordingly */
+        if (file.isDirectory()) {
+            preloadTests(mRelativePath);
+        } else {
+            mTestsList.add(mRelativePath);
+        }
+        mDoneMsg.obj = mTestsList;
+        mDoneMsg.sendToTarget();
+    }
+
+    /**
+     * Loads all the tests from the given folders and all the subfolders
+     * into mTestsList.
+     *
+     * @param dirRelativePath
+     */
+    private void preloadTests(String dirRelativePath) {
+        LinkedList<String> foldersList = new LinkedList<String>();
+        foldersList.add(dirRelativePath);
+
+        String relativePath;
+        String currentDirRelativePath;
+        String itemName;
+        File[] items;
+        while (!foldersList.isEmpty()) {
+            currentDirRelativePath = foldersList.removeFirst();
+            items = new File(TESTS_ROOT_DIR_PATH, currentDirRelativePath).listFiles();
+            for (File item : items) {
+                itemName = item.getName();
+                relativePath = currentDirRelativePath + File.separator + itemName;
+
+                if (item.isDirectory() && FileFilter.isTestDir(itemName)) {
+                    foldersList.add(relativePath);
+                    continue;
+                }
+
+                if (FileFilter.isTestFile(itemName)) {
+                    if (!mFileFilter.isSkip(relativePath)) {
+                        mTestsList.add(relativePath);
+                    } else {
+                        //mSummarizer.addSkippedTest(relativePath);
+                        /** TODO: Summarizer is now in service - figure out how to send the info */
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java
index 7bab4ae..33ee4c7 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/TextResult.java
@@ -61,7 +61,10 @@
         mExpectedResult = bundle.getString("expectedTextualResult");
         mActualResult = bundle.getString("actualTextualResult");
         mRelativePath = bundle.getString("relativePath");
-        mResultCode = ResultCode.valueOf(bundle.getString("resultCode"));
+        String resultCode = bundle.getString("resultCode");
+        if (resultCode != null) {
+            mResultCode = ResultCode.valueOf(resultCode);
+        }
     }
 
     @Override
@@ -177,4 +180,9 @@
         bundle.putString("type", getType().name());
         return bundle;
     }
+
+    @Override
+    public String getRelativePath() {
+        return mRelativePath;
+    }
 }
\ No newline at end of file
diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
index 790d1d3..661a8ec 100644
--- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
+++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/ui/DirListActivity.java
@@ -17,7 +17,7 @@
 package com.android.dumprendertree2.ui;
 
 import com.android.dumprendertree2.FileFilter;
-import com.android.dumprendertree2.LayoutTestsRunner;
+import com.android.dumprendertree2.TestsListActivity;
 import com.android.dumprendertree2.R;
 
 import android.app.Activity;
@@ -203,9 +203,9 @@
                 } else {
                     /** Run the test */
                     Intent intent = new Intent();
-                    intent.setClass(DirListActivity.this, LayoutTestsRunner.class);
+                    intent.setClass(DirListActivity.this, TestsListActivity.class);
                     intent.setAction(Intent.ACTION_RUN);
-                    intent.putExtra(LayoutTestsRunner.EXTRA_TEST_PATH, item.getRelativePath());
+                    intent.putExtra(TestsListActivity.EXTRA_TEST_PATH, item.getRelativePath());
                     startActivity(intent);
                 }
             }
@@ -277,9 +277,9 @@
                         removeDialog(DIALOG_RUN_ABORT_DIR);
                         /** Run the tests */
                         Intent intent = new Intent();
-                        intent.setClass(DirListActivity.this, LayoutTestsRunner.class);
+                        intent.setClass(DirListActivity.this, TestsListActivity.class);
                         intent.setAction(Intent.ACTION_RUN);
-                        intent.putExtra(LayoutTestsRunner.EXTRA_TEST_PATH,
+                        intent.putExtra(TestsListActivity.EXTRA_TEST_PATH,
                                 args.getString("relativePath"));
                         startActivity(intent);
                     }
