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

Commit 0798af53 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Deflake some telecom unit tests" am: efc7dead am: 5a190dff am: d404d1d8

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telecomm/+/1385293

Change-Id: Ia13235d592ff161dc47b953d2ce38367922788e7
parents 73750479 d404d1d8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                            mServiceInterface.createConnectionComplete(callId,
                                    Log.getExternalSession());
                        } catch (RemoteException e) {
                            logOutgoing("createConnectionComplete remote exception=%s", e);
                        }
                    }
                }
+13 −0
Original line number Diff line number Diff line
@@ -163,6 +163,9 @@ public class BasicCallTests extends TelecomSystemTest {
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
        telecomManager.acceptRingingCall();

        waitForHandlerAction(mTelecomSystem.getCallsManager()
                .getConnectionServiceFocusManager().getHandler(), TEST_TIMEOUT);

        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answer(eq(ids.mConnectionId), any());
        mConnectionServiceFixtureA.sendSetActive(ids.mConnectionId);
@@ -219,6 +222,9 @@ public class BasicCallTests extends TelecomSystemTest {
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
        telecomManager.acceptRingingCall(VideoProfile.STATE_AUDIO_ONLY);

        waitForHandlerAction(mTelecomSystem.getCallsManager()
                .getConnectionServiceFocusManager().getHandler(), TEST_TIMEOUT);

        // The generic answer method on the ConnectionService is used to answer audio-only calls.
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answer(eq(ids.mConnectionId), any());
@@ -248,6 +254,9 @@ public class BasicCallTests extends TelecomSystemTest {
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
        telecomManager.acceptRingingCall(999 /* invalid videostate */);

        waitForHandlerAction(mTelecomSystem.getCallsManager()
                .getConnectionServiceFocusManager().getHandler(), TEST_TIMEOUT);

        // Answer video API should be called
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answerVideo(eq(ids.mConnectionId), eq(VideoProfile.STATE_BIDIRECTIONAL), any());
@@ -626,6 +635,10 @@ public class BasicCallTests extends TelecomSystemTest {
        mConnectionServiceFixtureA.
                sendSetDisconnected(outgoing.mConnectionId, DisconnectCause.REMOTE);

        waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager()
                .getCallAudioModeStateMachine().getHandler(), TEST_TIMEOUT);
        waitForHandlerAction(mTelecomSystem.getCallsManager().getCallAudioManager()
                .getCallAudioRouteStateMachine().getHandler(), TEST_TIMEOUT);
        verify(audioManager, timeout(TEST_TIMEOUT))
                .abandonAudioFocusForCall();
        verify(audioManager, timeout(TEST_TIMEOUT).atLeastOnce())
+1 −0
Original line number Diff line number Diff line
@@ -249,6 +249,7 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService>

        @Override
        public void createConnectionComplete(String id, Session.Info info) throws RemoteException {
            Log.i(ConnectionServiceFixture.this, "createConnectionComplete: %s", id);
            mConnectionServiceDelegateAdapter.createConnectionComplete(id, null /*Session.Info*/);
        }

+5 −0
Original line number Diff line number Diff line
@@ -925,7 +925,12 @@ public class TelecomSystemTest extends TelecomTestCase {
        // Wait for the handler to start the CallerInfo lookup
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);

        // Wait a few more times to address flakiness due to timing issues.
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);

        // Ensure callback to CS on successful creation happened.

        verify(connectionServiceFixture.getTestDouble(), timeout(TEST_TIMEOUT))
                .createConnectionComplete(anyString(), any());