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

Commit 560f8f30 authored by Hall Liu's avatar Hall Liu
Browse files

Wait on correct handler in tests

Since the CS focus manager was moved onto its own thread, wait on that
thread's handler in the tests instead.

Test: unit
Change-Id: Ib2ca729dcead386f2238fe2a16dcba75d71e3f76
parent d26bde7f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3795,7 +3795,7 @@ public class CallsManager extends Call.ListenerBase
        call.startCreateConnection(mPhoneAccountRegistrar);
    }

    ConnectionServiceFocusManager getConnectionServiceFocusManager() {
    public ConnectionServiceFocusManager getConnectionServiceFocusManager() {
        return mConnectionSvrFocusMgr;
    }

+4 −2
Original line number Diff line number Diff line
@@ -771,14 +771,16 @@ public class TelecomSystemTest extends TelecomTestCase {
            ConnectionServiceFixture connectionServiceFixture) throws Exception {

        // Wait for the focus tracker.
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        waitForHandlerAction(mTelecomSystem.getCallsManager()
                .getConnectionServiceFocusManager().getHandler(), TEST_TIMEOUT);

        verify(connectionServiceFixture.getTestDouble())
                .createConnection(eq(phoneAccountHandle), anyString(), any(ConnectionRequest.class),
                        eq(false)/*isIncoming*/, anyBoolean(), any());
        // Wait for handleCreateConnectionComplete
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        assertEquals(startingNumConnections + 1, connectionServiceFixture.mConnectionById.size());
        assertEquals(startingNumConnections + 1,
                connectionServiceFixture.mConnectionById.size());

        // Wait for the callback in ConnectionService#onAdapterAttached to execute.
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);