diff options
| author | 2023-10-25 17:58:21 +0000 | |
|---|---|---|
| committer | 2023-10-25 17:58:21 +0000 | |
| commit | 8137f44aa5f0ebf0b9d9bb326152435ef8dc1e39 (patch) | |
| tree | 0f1b6ba3671d000e30f66f95ce7900fc5e79f888 | |
| parent | 6a9403418337c0268591e7b6198bb5dde3df3ba4 (diff) | |
| parent | 80473543abd702509c268702b1278341d2900584 (diff) | |
Merge "Make SystemUIDialogTest deviceless" into main
| -rw-r--r-- | packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java (renamed from packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java) | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java index 07ffd112300b..162008808791 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/SystemUIDialogTest.java @@ -1,15 +1,17 @@ /* * Copyright (C) 2017 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the specific language governing - * permissions and limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.android.systemui.statusbar.phone; @@ -19,8 +21,6 @@ import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -29,9 +29,9 @@ import static org.mockito.Mockito.when; import android.content.BroadcastReceiver; import android.content.Intent; import android.content.IntentFilter; -import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; +import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; @@ -43,12 +43,13 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.util.concurrent.atomic.AtomicBoolean; -@RunWith(AndroidTestingRunner.class) +@RunWith(AndroidJUnit4.class) @RunWithLooper @SmallTest public class SystemUIDialogTest extends SysuiTestCase { @@ -76,12 +77,13 @@ public class SystemUIDialogTest extends SysuiTestCase { dialog.show(); verify(mBroadcastDispatcher).registerReceiver(broadcastReceiverCaptor.capture(), - intentFilterCaptor.capture(), eq(null), any()); + intentFilterCaptor.capture(), ArgumentMatchers.eq(null), ArgumentMatchers.any()); assertTrue(intentFilterCaptor.getValue().hasAction(Intent.ACTION_SCREEN_OFF)); assertTrue(intentFilterCaptor.getValue().hasAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)); dialog.dismiss(); - verify(mBroadcastDispatcher).unregisterReceiver(eq(broadcastReceiverCaptor.getValue())); + verify(mBroadcastDispatcher).unregisterReceiver( + ArgumentMatchers.eq(broadcastReceiverCaptor.getValue())); } @@ -90,11 +92,12 @@ public class SystemUIDialogTest extends SysuiTestCase { final SystemUIDialog dialog = new SystemUIDialog(mContext, 0, false); dialog.show(); - verify(mBroadcastDispatcher, never()).registerReceiver(any(), any(), eq(null), any()); + verify(mBroadcastDispatcher, never()).registerReceiver(ArgumentMatchers.any(), + ArgumentMatchers.any(), ArgumentMatchers.eq(null), ArgumentMatchers.any()); assertTrue(dialog.isShowing()); dialog.dismiss(); - verify(mBroadcastDispatcher, never()).unregisterReceiver(any()); + verify(mBroadcastDispatcher, never()).unregisterReceiver(ArgumentMatchers.any()); assertFalse(dialog.isShowing()); } |