Search in sources :

Example 6 with VideoPreference

use of com.android.settings.widget.VideoPreference in project android_packages_apps_Settings by omnirom.

the class GesturePreferenceControllerTest method onPause_shouldStopVideoPreference.

@Test
public void onPause_shouldStopVideoPreference() {
    final VideoPreference videoPreference = mock(VideoPreference.class);
    when(mScreen.findPreference(mController.getVideoPrefKey())).thenReturn(videoPreference);
    mController.mIsPrefAvailable = true;
    mController.displayPreference(mScreen);
    mController.onPause();
    verify(videoPreference).onViewInvisible();
}
Also used : VideoPreference(com.android.settings.widget.VideoPreference) Test(org.junit.Test)

Example 7 with VideoPreference

use of com.android.settings.widget.VideoPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class GesturePreferenceControllerTest method onPause_shouldUpdateVideoPauseState.

@Test
public void onPause_shouldUpdateVideoPauseState() {
    final VideoPreference videoPreference = mock(VideoPreference.class);
    when(mScreen.findPreference(mController.getVideoPrefKey())).thenReturn(videoPreference);
    mController.mIsPrefAvailable = true;
    mController.displayPreference(mScreen);
    when(videoPreference.isVideoPaused()).thenReturn(true);
    mController.onPause();
    assertThat(mController.mVideoPaused).isTrue();
    when(videoPreference.isVideoPaused()).thenReturn(false);
    mController.onPause();
    assertThat(mController.mVideoPaused).isFalse();
}
Also used : VideoPreference(com.android.settings.widget.VideoPreference) Test(org.junit.Test)

Example 8 with VideoPreference

use of com.android.settings.widget.VideoPreference in project android_packages_apps_Settings by LineageOS.

the class GesturePreferenceControllerTest method onPause_shouldUpdateVideoPauseState.

@Test
public void onPause_shouldUpdateVideoPauseState() {
    final VideoPreference videoPreference = mock(VideoPreference.class);
    when(mScreen.findPreference(mController.getVideoPrefKey())).thenReturn(videoPreference);
    mController.mIsPrefAvailable = true;
    mController.displayPreference(mScreen);
    when(videoPreference.isVideoPaused()).thenReturn(true);
    mController.onPause();
    assertThat(mController.mVideoPaused).isTrue();
    when(videoPreference.isVideoPaused()).thenReturn(false);
    mController.onPause();
    assertThat(mController.mVideoPaused).isFalse();
}
Also used : VideoPreference(com.android.settings.widget.VideoPreference) Test(org.junit.Test)

Example 9 with VideoPreference

use of com.android.settings.widget.VideoPreference in project android_packages_apps_Settings by LineageOS.

the class GesturePreferenceControllerTest method onResume_shouldStartVideoPreferenceWithVideoPauseState.

@Test
public void onResume_shouldStartVideoPreferenceWithVideoPauseState() {
    final VideoPreference videoPreference = mock(VideoPreference.class);
    when(mScreen.findPreference(mController.getVideoPrefKey())).thenReturn(videoPreference);
    mController.mIsPrefAvailable = true;
    mController.displayPreference(mScreen);
    final Bundle savedState = new Bundle();
    mController.onCreate(null);
    mController.onResume();
    verify(videoPreference).onViewVisible(false);
    reset(videoPreference);
    savedState.putBoolean(mController.KEY_VIDEO_PAUSED, true);
    mController.onCreate(savedState);
    mController.onResume();
    verify(videoPreference).onViewVisible(true);
    reset(videoPreference);
    savedState.putBoolean(mController.KEY_VIDEO_PAUSED, false);
    mController.onCreate(savedState);
    mController.onResume();
    verify(videoPreference).onViewVisible(false);
}
Also used : Bundle(android.os.Bundle) VideoPreference(com.android.settings.widget.VideoPreference) Test(org.junit.Test)

Example 10 with VideoPreference

use of com.android.settings.widget.VideoPreference in project android_packages_apps_Settings by omnirom.

the class GesturePreferenceControllerTest method onResume_shouldStartVideoPreferenceWithVideoPauseState.

@Test
public void onResume_shouldStartVideoPreferenceWithVideoPauseState() {
    final VideoPreference videoPreference = mock(VideoPreference.class);
    when(mScreen.findPreference(mController.getVideoPrefKey())).thenReturn(videoPreference);
    mController.mIsPrefAvailable = true;
    mController.displayPreference(mScreen);
    final Bundle savedState = new Bundle();
    mController.onCreate(null);
    mController.onResume();
    verify(videoPreference).onViewVisible(false);
    reset(videoPreference);
    savedState.putBoolean(mController.KEY_VIDEO_PAUSED, true);
    mController.onCreate(savedState);
    mController.onResume();
    verify(videoPreference).onViewVisible(true);
    reset(videoPreference);
    savedState.putBoolean(mController.KEY_VIDEO_PAUSED, false);
    mController.onCreate(savedState);
    mController.onResume();
    verify(videoPreference).onViewVisible(false);
}
Also used : Bundle(android.os.Bundle) VideoPreference(com.android.settings.widget.VideoPreference) Test(org.junit.Test)

Aggregations

VideoPreference (com.android.settings.widget.VideoPreference)24 Test (org.junit.Test)23 Bundle (android.os.Bundle)7 SharedPreferences (android.content.SharedPreferences)1 SuggestionFeatureProvider (com.android.settings.dashboard.suggestions.SuggestionFeatureProvider)1