diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java index 74fb440358b..b9de66db482 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningAppearancePreferenceControllerTest.java @@ -17,8 +17,10 @@ package com.android.settings.accessibility; import static com.google.common.truth.Truth.assertThat; +import static org.robolectric.Shadows.shadowOf; import android.content.Context; +import android.os.Looper; import android.provider.Settings; import android.view.accessibility.CaptioningManager; @@ -68,7 +70,9 @@ public class CaptioningAppearancePreferenceControllerTest { @Test public void getSummary_smallestScale_shouldReturnExpectedSummary() { - mShadowCaptioningManager.setFontScale(0.25f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.25f); + shadowOf(Looper.getMainLooper()).idle(); final String expectedSummary = getSummaryCombo(/* fontScaleIndex= */ 0, DEFAULT_PRESET_INDEX); @@ -77,7 +81,9 @@ public class CaptioningAppearancePreferenceControllerTest { @Test public void getSummary_smallScale_shouldReturnExpectedSummary() { - mShadowCaptioningManager.setFontScale(0.5f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.5f); + shadowOf(Looper.getMainLooper()).idle(); final String expectedSummary = getSummaryCombo(/* fontScaleIndex= */ 1, DEFAULT_PRESET_INDEX); @@ -86,7 +92,9 @@ public class CaptioningAppearancePreferenceControllerTest { @Test public void getSummary_mediumScale_shouldReturnExpectedSummary() { - mShadowCaptioningManager.setFontScale(1.0f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.0f); + shadowOf(Looper.getMainLooper()).idle(); final String expectedSummary = getSummaryCombo(/* fontScaleIndex= */ 2, DEFAULT_PRESET_INDEX); @@ -95,7 +103,9 @@ public class CaptioningAppearancePreferenceControllerTest { @Test public void getSummary_largeScale_shouldReturnExpectedSummary() { - mShadowCaptioningManager.setFontScale(1.5f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.5f); + shadowOf(Looper.getMainLooper()).idle(); final String expectedSummary = getSummaryCombo(/* fontScaleIndex= */ 3, DEFAULT_PRESET_INDEX); @@ -104,7 +114,9 @@ public class CaptioningAppearancePreferenceControllerTest { @Test public void getSummary_largestScale_shouldReturnExpectedSummary() { - mShadowCaptioningManager.setFontScale(2.0f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 2.0f); + shadowOf(Looper.getMainLooper()).idle(); final String expectedSummary = getSummaryCombo(/* fontScaleIndex= */ 4, DEFAULT_PRESET_INDEX); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java index 0ea7a41a61a..e847f438070 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundColorControllerTest.java @@ -127,7 +127,8 @@ public class CaptioningBackgroundColorControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0xFFFF0000); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java index 56a61ecff79..5036ba03706 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningBackgroundOpacityControllerTest.java @@ -103,7 +103,8 @@ public class CaptioningBackgroundOpacityControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0x80FFFFFF); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java index f1a8566183f..c55e087df77 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeColorControllerTest.java @@ -101,7 +101,8 @@ public class CaptioningEdgeColorControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0xFFFF0000); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java index 11871f8c70f..354115f65ba 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningEdgeTypeControllerTest.java @@ -103,7 +103,8 @@ public class CaptioningEdgeTypeControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, CaptionStyle.EDGE_TYPE_OUTLINE); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java index 8aeb37ef44a..b00d8d899f7 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningFontSizeControllerTest.java @@ -23,7 +23,10 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; +import static org.robolectric.Shadows.shadowOf; + import android.content.Context; +import android.os.Looper; import android.provider.Settings; import android.view.accessibility.CaptioningManager; @@ -85,7 +88,9 @@ public class CaptioningFontSizeControllerTest { @Test public void updateState_bySmallValue_shouldReturnSmall() { - mShadowCaptioningManager.setFontScale(0.5f); + Settings.Secure.putFloat(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.5f); + shadowOf(Looper.getMainLooper()).idle(); mController.updateState(mPreference); @@ -94,7 +99,8 @@ public class CaptioningFontSizeControllerTest { @Test public void onPreferenceChange_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onPreferenceChange(mPreference, "0.5"); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java index 8991bad61bb..9e9c926defc 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundColorControllerTest.java @@ -127,7 +127,8 @@ public class CaptioningForegroundColorControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0xFFFF0000); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java index 1ffff60a201..a88b5f54f77 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningForegroundOpacityControllerTest.java @@ -103,7 +103,8 @@ public class CaptioningForegroundOpacityControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0x80FFFFFF); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java index c91baa20eb4..1614c8f4acd 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningPresetControllerTest.java @@ -103,7 +103,8 @@ public class CaptioningPresetControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, CaptionStyle.PRESET_CUSTOM); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java index e0a04bce8ca..7523db6d22e 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningTogglePreferenceControllerTest.java @@ -82,7 +82,8 @@ public class CaptioningTogglePreferenceControllerTest { @Test public void displayPreference_captionEnabled_shouldSetChecked() { - mShadowCaptioningManager.setEnabled(true); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON); mController.displayPreference(mScreen); @@ -91,7 +92,8 @@ public class CaptioningTogglePreferenceControllerTest { @Test public void displayPreference_captionDisabled_shouldSetUnchecked() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); @@ -100,7 +102,8 @@ public class CaptioningTogglePreferenceControllerTest { @Test public void performClick_captionEnabled_shouldSetCaptionDisabled() { - mShadowCaptioningManager.setEnabled(true); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, ON); mController.displayPreference(mScreen); mSwitchPreference.performClick(); @@ -111,7 +114,8 @@ public class CaptioningTogglePreferenceControllerTest { @Test public void performClick_captionDisabled_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mSwitchPreference.performClick(); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java index 4d33fb3be10..aa7d3eb53a9 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningTypefaceControllerTest.java @@ -95,7 +95,8 @@ public class CaptioningTypefaceControllerTest { @Test public void onPreferenceChange_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onPreferenceChange(mPreference, "serif"); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java index f916778d9bc..12582145c20 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowColorControllerTest.java @@ -128,7 +128,8 @@ public class CaptioningWindowColorControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0xFFFF0000); diff --git a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java index 99eb1e5dcfb..0e872a09d09 100644 --- a/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java +++ b/tests/robotests/src/com/android/settings/accessibility/CaptioningWindowOpacityControllerTest.java @@ -102,7 +102,8 @@ public class CaptioningWindowOpacityControllerTest { @Test public void onValueChanged_shouldSetCaptionEnabled() { - mShadowCaptioningManager.setEnabled(false); + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF); mController.displayPreference(mScreen); mController.onValueChanged(mPreference, 0x80FFFFFF);