Fix ConnectivityPreferenceControllerTest failures

- Security team add new parameter to registerReceiver() for security
design.

- Update the test case with the new parameters added.

Bug: 215311415
Test: manual test
make RunSettingsLibRoboTests
ROBOTEST_FILTER=ConnectivityPreferenceControllerTest

Change-Id: If68a5faf08b938b9b7ea26389d84b04e915f8811
This commit is contained in:
Weng Su
2022-01-25 16:07:56 +08:00
parent 73df1b4d61
commit f560cfa220

View File

@@ -18,6 +18,7 @@ package com.android.settingslib.deviceinfo;
import static com.google.common.truth.Truth.assertWithMessage;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.doReturn;
@@ -33,7 +34,6 @@ import android.os.Handler;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -55,7 +55,6 @@ public class ConnectivityPreferenceControllerTest {
}
@Test
@Ignore
public void testBroadcastReceiver() {
final AbstractConnectivityPreferenceController preferenceController =
spy(new ConcreteConnectivityPreferenceController(mContext, mLifecycle));
@@ -73,7 +72,7 @@ public class ConnectivityPreferenceControllerTest {
verify(mContext, times(1))
.registerReceiver(receiverArgumentCaptor.capture(),
filterArgumentCaptor.capture(),
anyString(), nullable(Handler.class));
anyString(), nullable(Handler.class), anyInt());
final BroadcastReceiver receiver = receiverArgumentCaptor.getValue();
final IntentFilter filter = filterArgumentCaptor.getValue();