OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.components.background_task_scheduler; | 5 package org.chromium.components.background_task_scheduler; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 /** Dummy implementation of a background task used for testing. */ | 9 /** Dummy implementation of a background task used for testing. */ |
10 class TestBackgroundTask implements BackgroundTask { | 10 class TestBackgroundTask implements BackgroundTask { |
| 11 private static int sRescheduleCalls = 0; |
| 12 |
11 public TestBackgroundTask() {} | 13 public TestBackgroundTask() {} |
12 | 14 |
13 @Override | 15 @Override |
14 public boolean onStartTask( | 16 public boolean onStartTask( |
15 Context context, TaskParameters taskParameters, TaskFinishedCallback
callback) { | 17 Context context, TaskParameters taskParameters, TaskFinishedCallback
callback) { |
16 return false; | 18 return false; |
17 } | 19 } |
18 | 20 |
19 @Override | 21 @Override |
20 public boolean onStopTask(Context context, TaskParameters taskParameters) { | 22 public boolean onStopTask(Context context, TaskParameters taskParameters) { |
21 return false; | 23 return false; |
22 } | 24 } |
| 25 |
| 26 @Override |
| 27 public void reschedule(Context context) { |
| 28 sRescheduleCalls++; |
| 29 } |
| 30 |
| 31 public static int getRescheduleCalls() { |
| 32 return sRescheduleCalls; |
| 33 } |
| 34 |
| 35 public static void reset() { |
| 36 sRescheduleCalls = 0; |
| 37 } |
23 } | 38 } |
OLD | NEW |