Search in sources :

Example 1 with OnStop

use of com.android.settingslib.core.lifecycle.events.OnStop in project android_packages_apps_Settings by omnirom.

the class ContextualCardManagerTest method onWindowFocusChanged_loseFocusAndNoConditional_stopMonitoringConditionCard.

@Test
public void onWindowFocusChanged_loseFocusAndNoConditional_stopMonitoringConditionCard() {
    final ContextualCardManager manager = spy(mManager);
    final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
    doReturn(pool).when(manager).getControllerRendererPool();
    final ConditionContextualCardController conditionController = pool.getController(mContext, ContextualCard.CardType.CONDITIONAL);
    final OnStop controller = spy((OnStop) conditionController);
    doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
    manager.onWindowFocusChanged(false);
    verify(controller, atLeast(1)).onStop();
}
Also used : OnStop(com.android.settingslib.core.lifecycle.events.OnStop) ConditionContextualCardController(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController) Test(org.junit.Test)

Example 2 with OnStop

use of com.android.settingslib.core.lifecycle.events.OnStop in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ContextualCardManagerTest method onWindowFocusChanged_loseFocusAndNoConditional_stopMonitoringConditionCard.

@Test
public void onWindowFocusChanged_loseFocusAndNoConditional_stopMonitoringConditionCard() {
    final ContextualCardManager manager = spy(mManager);
    final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
    doReturn(pool).when(manager).getControllerRendererPool();
    final ConditionContextualCardController conditionController = pool.getController(mContext, ContextualCard.CardType.CONDITIONAL);
    final OnStop controller = spy((OnStop) conditionController);
    doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
    manager.onWindowFocusChanged(false);
    verify(controller, atLeast(1)).onStop();
}
Also used : OnStop(com.android.settingslib.core.lifecycle.events.OnStop) ConditionContextualCardController(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController) Test(org.junit.Test)

Example 3 with OnStop

use of com.android.settingslib.core.lifecycle.events.OnStop in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ContextualCardManagerTest method onWindowFocusChanged_loseFocusAndHasConditionals_stopMonitoringConditionCard.

@Test
public void onWindowFocusChanged_loseFocusAndHasConditionals_stopMonitoringConditionCard() {
    mManager.mContextualCards.add(new ConditionalContextualCard.Builder().build());
    mManager.mContextualCards.add(new ConditionFooterContextualCard.Builder().build());
    final ContextualCardManager manager = spy(mManager);
    final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
    doReturn(pool).when(manager).getControllerRendererPool();
    final ConditionContextualCardController conditionController = pool.getController(mContext, ContextualCard.CardType.CONDITIONAL);
    final OnStop controller = spy((OnStop) conditionController);
    doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
    manager.onWindowFocusChanged(false);
    verify(controller, atLeast(2)).onStop();
}
Also used : OnStop(com.android.settingslib.core.lifecycle.events.OnStop) ConditionContextualCardController(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController) Test(org.junit.Test)

Example 4 with OnStop

use of com.android.settingslib.core.lifecycle.events.OnStop in project android_packages_apps_Settings by omnirom.

the class ContextualCardManagerTest method onWindowFocusChanged_loseFocusAndHasConditionals_stopMonitoringConditionCard.

@Test
public void onWindowFocusChanged_loseFocusAndHasConditionals_stopMonitoringConditionCard() {
    mManager.mContextualCards.add(new ConditionalContextualCard.Builder().build());
    mManager.mContextualCards.add(new ConditionFooterContextualCard.Builder().build());
    final ContextualCardManager manager = spy(mManager);
    final ControllerRendererPool pool = spy(mManager.mControllerRendererPool);
    doReturn(pool).when(manager).getControllerRendererPool();
    final ConditionContextualCardController conditionController = pool.getController(mContext, ContextualCard.CardType.CONDITIONAL);
    final OnStop controller = spy((OnStop) conditionController);
    doReturn(controller).when(pool).getController(mContext, ContextualCard.CardType.CONDITIONAL);
    manager.onWindowFocusChanged(false);
    verify(controller, atLeast(2)).onStop();
}
Also used : OnStop(com.android.settingslib.core.lifecycle.events.OnStop) ConditionContextualCardController(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController) Test(org.junit.Test)

Aggregations

ConditionContextualCardController (com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardController)4 OnStop (com.android.settingslib.core.lifecycle.events.OnStop)4 Test (org.junit.Test)4