public boolean setPaused(boolean shouldPause) { boolean wasPaused = isPaused(); if (shouldPause) { pause(); } else { unPause(); } return wasPaused; }
@Test public void whenLooperIsNotPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.unPauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isFalse(); assertThat(transcript).containsExactly("finishedOnCreate", "onCreate"); }
@Test public void whenLooperIsNotPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.unPauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isFalse(); assertThat(transcript).containsAllOf("finishedOnCreate", "onCreate"); }
@Test public void whenLooperIsNotPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.unPauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isFalse(); assertThat(transcript).containsExactly("finishedOnCreate", "onCreate"); }
@Test public void whenLooperIsAlreadyPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.pauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isTrue(); assertThat(transcript).contains("finishedOnCreate"); ShadowLooper.unPauseMainLooper(); assertThat(transcript).contains("onCreate"); }
@Test public void whenLooperIsAlreadyPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.pauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isTrue(); assertThat(transcript).contains("finishedOnCreate"); ShadowLooper.unPauseMainLooper(); assertThat(transcript).contains("onCreate"); }
@Test public void whenLooperIsAlreadyPaused_shouldCreateWithMainLooperPaused() throws Exception { ShadowLooper.pauseMainLooper(); controller.create(); assertThat(shadowOf(Looper.getMainLooper()).isPaused()).isTrue(); assertThat(transcript).contains("finishedOnCreate"); ShadowLooper.unPauseMainLooper(); assertThat(transcript).contains("onCreate"); }
public boolean setPaused(boolean shouldPause) { boolean wasPaused = isPaused(); if (shouldPause) { pause(); } else { unPause(); } return wasPaused; }
public boolean setPaused(boolean shouldPause) { boolean wasPaused = isPaused(); if (shouldPause) { pause(); } else { unPause(); } return wasPaused; }
public boolean setPaused(boolean shouldPause) { boolean wasPaused = isPaused(); if (shouldPause) { pause(); } else { unPause(); } return wasPaused; }
public boolean setPaused(boolean shouldPause) { boolean wasPaused = isPaused(); if (shouldPause) { pause(); } else { unPause(); } return wasPaused; }