TrackRecordingServiceTest.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:mytracks 作者:
@MediumTest
public void testResumeAfterReboot_tooManyAttempts() throws Exception {
  // Insert a dummy track.
  createDummyTrack(123L, System.currentTimeMillis(), true);

  // Set the number of attempts to max.
  updateAutoResumePrefs(TrackRecordingService.MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS,
      PreferencesUtils.AUTO_RESUME_TRACK_TIMEOUT_DEFAULT);

  // Start the service in "resume" mode (simulates the on-reboot action).
  Intent startIntent = createStartIntent();
  startIntent.putExtra(TrackRecordingService.RESUME_TRACK_EXTRA_NAME, true);
  startService(startIntent);
  assertNotNull(getService());

  // We don't expect to resume the previous track, because there were already
  // too many attempts.
  assertFalse(getService().isRecording());
  ITrackRecordingService service = bindAndGetService(createStartIntent());
  assertEquals(-1L, service.getRecordingTrackId());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号