Merge "Re-enable failed tests under settings/widget/" into main
diff --git a/tests/robotests/src/com/android/settings/widget/RestrictedButtonTest.java b/tests/robotests/src/com/android/settings/widget/RestrictedButtonTest.java
index d696342..4b05b91 100644
--- a/tests/robotests/src/com/android/settings/widget/RestrictedButtonTest.java
+++ b/tests/robotests/src/com/android/settings/widget/RestrictedButtonTest.java
@@ -34,7 +34,6 @@
 import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
@@ -44,7 +43,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-@Ignore("b/315133235")
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {ShadowUserManager.class, ShadowDevicePolicyManager.class})
 public class RestrictedButtonTest {
diff --git a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
index 35dc666..530517f 100644
--- a/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/VideoPreferenceTest.java
@@ -35,18 +35,19 @@
 
 import androidx.preference.PreferenceFragmentCompat;
 import androidx.preference.PreferenceViewHolder;
+import androidx.test.core.app.ApplicationProvider;
 
 import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowSettingsMediaPlayer;
 
 import org.junit.Before;
-import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
 import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
 import org.robolectric.shadows.androidx.fragment.FragmentController;
 
@@ -55,7 +56,8 @@
 public class VideoPreferenceTest {
     private static final int VIDEO_WIDTH = 100;
     private static final int VIDEO_HEIGHT = 150;
-
+    @Rule
+    public final MockitoRule mMockitoRule = MockitoJUnit.rule();
     private VideoPreference.AnimationController mAnimationController;
     @Mock
     private ImageView fakePreview;
@@ -68,9 +70,7 @@
 
     @Before
     public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = RuntimeEnvironment.application;
+        mContext = ApplicationProvider.getApplicationContext();
         mAnimationController = spy(
                 new MediaAnimationController(mContext, R.raw.sample_video));
         mVideoPreference = new VideoPreference(mContext, null /* attrs */);
@@ -141,7 +141,6 @@
         assertThat(mAnimationController.isPlaying()).isTrue();
     }
 
-    @Ignore("b/315133235")
     @Test
     @Config(qualifiers = "mcc999")
     public void onViewVisible_createAnimationController() {