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

Commit 5b8551ef authored by Hall Liu's avatar Hall Liu
Browse files

Fix unit tests and coverage

1. Fix the NPE that happened because hasVideoCall in CallsManager was
not visible to the unit tests
2. Add additional env variables to ensure that emma is in the classpath
when generating code coverage

Test: unit tests
Change-Id: Ibd621267b4af4e20c41458eb674fd120ca0a1859
parent 5ce1a784
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -51,15 +51,15 @@ lite_test_telecom() {
    # Build and exit script early if build fails

    if [ $coverage = true ] ; then
      emma_opt="EMMA_INSTRUMENT_STATIC=true"
      emma_opt="EMMA_INSTRUMENT=true LOCAL_EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true"
    else
      emma_opt="EMMA_INSTRUMENT_STATIC=false"
      emma_opt="EMMA_INSTRUMENT=false"
    fi

    if [ $installwdep = true ] ; then
      mmma -j40 "packages/services/Telecomm/tests" ${emma_opt}
      (export ${emma_opt}; mmma -j40 "packages/services/Telecomm/tests")
    else
      mmm "packages/services/Telecomm/tests" ${emma_opt}
      (export ${emma_opt}; mmm "packages/services/Telecomm/tests")
    fi
    if [ $? -ne 0 ] ; then
      echo "Make failed! try using -a instead of -i if building with coverage"
+1 −1
Original line number Diff line number Diff line
@@ -648,7 +648,7 @@ public class CallsManager extends Call.ListenerBase
        return true;
    }

    boolean hasVideoCall() {
    public boolean hasVideoCall() {
        for (Call call : mCalls) {
            if (VideoProfile.isVideo(call.getVideoState())) {
                return true;
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class CallAudioRouteStateMachineTest

        when(mockCallsManager.getForegroundCall()).thenReturn(fakeCall);
        when(mockCallsManager.getLock()).thenReturn(mLock);
        when(mockCallsManager.hasVideoCall()).thenReturn(false);
        when(fakeCall.getConnectionService()).thenReturn(mockConnectionServiceWrapper);
        when(fakeCall.isAlive()).thenReturn(true);
        when(fakeCall.getSupportedAudioRoutes()).thenReturn(CallAudioState.ROUTE_ALL);