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

Commit efc7dead authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Deflake some telecom unit tests"

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


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

        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answer(eq(ids.mConnectionId), any());
                .answer(eq(ids.mConnectionId), any());
        mConnectionServiceFixtureA.sendSetActive(ids.mConnectionId);
        mConnectionServiceFixtureA.sendSetActive(ids.mConnectionId);
@@ -217,6 +220,9 @@ public class BasicCallTests extends TelecomSystemTest {
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
        telecomManager.acceptRingingCall(VideoProfile.STATE_AUDIO_ONLY);
        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.
        // The generic answer method on the ConnectionService is used to answer audio-only calls.
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answer(eq(ids.mConnectionId), any());
                .answer(eq(ids.mConnectionId), any());
@@ -246,6 +252,9 @@ public class BasicCallTests extends TelecomSystemTest {
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
                .getApplicationContext().getSystemService(Context.TELECOM_SERVICE);
        telecomManager.acceptRingingCall(999 /* invalid videostate */);
        telecomManager.acceptRingingCall(999 /* invalid videostate */);


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

        // Answer video API should be called
        // Answer video API should be called
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
        verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
                .answerVideo(eq(ids.mConnectionId), eq(VideoProfile.STATE_BIDIRECTIONAL), any());
                .answerVideo(eq(ids.mConnectionId), eq(VideoProfile.STATE_BIDIRECTIONAL), any());
@@ -621,6 +630,10 @@ public class BasicCallTests extends TelecomSystemTest {
        mConnectionServiceFixtureA.
        mConnectionServiceFixtureA.
                sendSetDisconnected(outgoing.mConnectionId, DisconnectCause.REMOTE);
                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))
        verify(audioManager, timeout(TEST_TIMEOUT))
                .abandonAudioFocusForCall();
                .abandonAudioFocusForCall();
        verify(audioManager, timeout(TEST_TIMEOUT).atLeastOnce())
        verify(audioManager, timeout(TEST_TIMEOUT).atLeastOnce())
+1 −0
Original line number Original line Diff line number Diff line
@@ -249,6 +249,7 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService>


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


+5 −0
Original line number Original line Diff line number Diff line
@@ -925,7 +925,12 @@ public class TelecomSystemTest extends TelecomTestCase {
        // Wait for the handler to start the CallerInfo lookup
        // Wait for the handler to start the CallerInfo lookup
        waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
        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.
        // Ensure callback to CS on successful creation happened.

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