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

Commit 3f54d497 authored by Hall Liu's avatar Hall Liu
Browse files

Fix more broken tests

Fix Analytics null pointer issue that was introduced by the
InCallService analytics change.

Mark flaky tests from CallLogManager so that they don't get run in
presubmit

Bug: 31041734
Change-Id: I974eaffaa938e37cf183bb551756b7bd2a9e7af1
parent 4d905458
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
        android-ex-camera2 \
        android-support-v4 \
        guava \
        mockito-target
        mockito-target \
        platform-test-annotations

LOCAL_SRC_FILES := \
        $(call all-java-files-under, src) \
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.Looper;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.platform.test.annotations.Postsubmit;
import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.telecom.DisconnectCause;
@@ -423,6 +424,7 @@ public class CallLogManagerTest extends TelecomTestCase {
    }

    @MediumTest
    @Postsubmit
    public void testLogCallDirectionOutgoingWithMultiUserCapability() {
        when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
                .thenReturn(makeFakePhoneAccount(mOtherUserAccountHandle,
@@ -516,6 +518,7 @@ public class CallLogManagerTest extends TelecomTestCase {
    }

    @MediumTest
    @Postsubmit
    public void testLogCallDirectionOutgoingFromManagedProfile() {
        when(mMockPhoneAccountRegistrar.getPhoneAccountUnchecked(any(PhoneAccountHandle.class)))
                .thenReturn(makeFakePhoneAccount(mManagedProfileAccountHandle, 0));
+2 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.text.TextUtils;

import com.android.internal.telecom.IInCallAdapter;
import com.android.internal.telecom.IInCallService;
import com.android.server.telecom.Analytics;
import com.android.server.telecom.BluetoothHeadsetProxy;
import com.android.server.telecom.Call;
import com.android.server.telecom.CallsManager;
@@ -101,6 +102,7 @@ public class InCallControllerTests extends TelecomTestCase {
    public void setUp() throws Exception {
        super.setUp();
        MockitoAnnotations.initMocks(this);
        when(mMockCall.getAnalytics()).thenReturn(new Analytics.CallInfo());
        doReturn(mMockResources).when(mMockContext).getResources();
        doReturn(SYS_PKG).when(mMockResources).getString(R.string.ui_default_package);
        doReturn(SYS_CLASS).when(mMockResources).getString(R.string.incall_default_class);
@@ -121,7 +123,6 @@ public class InCallControllerTests extends TelecomTestCase {
        when(mMockCall.isIncoming()).thenReturn(true);
        when(mMockCall.isExternalCall()).thenReturn(false);

        Intent queryIntent = new Intent(InCallService.SERVICE_INTERFACE);
        setupMockPackageManager(false /* default */, true /* system */, false /* external calls */);
        mInCallController.bindToServices(mMockCall);