Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20ce4a49 authored by Steve Block's avatar Steve Block Committed by Android (Google) Code Review
Browse files

Merge "In DRT2, correctly handle the case of zero tests"

parents ee864481 9eed25e2
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -398,6 +398,11 @@ public class LayoutTestsExecutor extends Activity {
    }

    private void startTests() {
        // This is called when the tests are started and after each crash.
        // We only send the reset message in the former case.
        if (mCurrentTestIndex <= 0) {
            sendResetMessage();
        }
        if (mCurrentTestIndex == 0) {
            sendFirstTestMessage();
        }
@@ -405,6 +410,15 @@ public class LayoutTestsExecutor extends Activity {
        runNextTest();
    }

    private void sendResetMessage() {
        try {
            Message serviceMsg = Message.obtain(null, ManagerService.MSG_RESET);
            mManagerServiceMessenger.send(serviceMsg);
        } catch (RemoteException e) {
            Log.e(LOG_TAG, "Error sending message to manager service:", e);
        }
    }

    private void sendFirstTestMessage() {
        try {
            Message serviceMsg = Message.obtain(null, ManagerService.MSG_FIRST_TEST);
+5 −1
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ public class ManagerService extends Service {
    static final int MSG_ALL_TESTS_FINISHED = 1;
    static final int MSG_FIRST_TEST = 2;
    static final int MSG_CURRENT_TEST_CRASHED = 3;
    static final int MSG_RESET = 4;

    /**
     * This handler is purely for IPC. It is used to create mMessenger
@@ -75,8 +76,11 @@ public class ManagerService extends Service {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MSG_FIRST_TEST:
                case MSG_RESET:
                    mSummarizer.reset();
                    break;

                case MSG_FIRST_TEST:
                    Bundle bundle = msg.getData();
                    ensureNextTestSetup(bundle.getString("firstTest"), bundle.getInt("index"));
                    break;