Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Issue 2030773002: Add unit tests for the Background Scheduler. (Closed)

Created:
4 years, 6 months ago by Pete Williamson
Modified:
4 years, 6 months ago
CC:
chromium-reviews, romax+watch_chromium.org, fgorski+watch_chromium.org, dewittj+watch_chromium.org, petewil+watch_chromium.org, chili+watch_chromium.org, dimich+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add unit tests for the Background Scheduler. Adding the unit tests required a lot of related changes to be able to do dependency injection, and adding some stub classes. The SchedulerBridgeInterface allows us to stub out the BackgroundSchedulerBridge, and we added a shadow class for GcmNetworkManager. This work is described at go/chrome-background-offlining. BUG=612325 Committed: https://crrev.com/36efc4e2983393cb9a92fc35c7656a31e932da59 Cr-Commit-Position: refs/heads/master@{#398738}

Patch Set 1 #

Total comments: 25

Patch Set 2 : CR feedback per DougArnett #

Total comments: 7

Patch Set 3 : CR feedback per DougArnett and chili #

Total comments: 12

Patch Set 4 : CR feedback per DougArnett #

Total comments: 22

Patch Set 5 : Split out persistence and time changes. #

Patch Set 6 : CR fixes per DougArnett #

Total comments: 6

Patch Set 7 : CR fixes per BauerB #

Total comments: 2

Patch Set 8 : Rename SchedulerRequestProcessor to BackgroundSchedulerProcessor #

Patch Set 9 : Callback<Boolean> and BackgroundSchedulerProcessor #

Total comments: 4

Patch Set 10 : Address BauerB nits #

Patch Set 11 : attempt to fix flaky shadow in test. #

Patch Set 12 : Disable flaky test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -48 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java View 1 2 3 4 5 6 7 2 chunks +8 lines, -3 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java View 1 2 3 4 5 6 7 8 4 chunks +31 lines, -19 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java View 1 2 3 4 5 6 3 chunks +1 line, -6 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java View 1 2 3 4 5 6 7 8 4 chunks +4 lines, -10 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerProcessorImpl.java View 1 2 3 4 5 6 7 8 1 chunk +22 lines, -0 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/offlinepages/TaskExtrasPacker.java View 1 2 3 4 5 6 1 chunk +25 lines, -0 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/BackgroundSchedulerProcessor.java View 1 2 3 4 5 6 7 8 1 chunk +21 lines, -0 lines 0 comments Download
M chrome/android/java_sources.gni View 1 2 3 4 5 6 7 8 9 10 2 chunks +8 lines, -1 line 0 comments Download
A chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java View 1 2 3 4 5 6 7 8 1 chunk +54 lines, -0 lines 0 comments Download
A chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerTest.java View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +52 lines, -0 lines 0 comments Download
A chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/ShadowGcmNetworkManager.java View 1 2 3 4 1 chunk +31 lines, -0 lines 0 comments Download
A chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/StubBackgroundSchedulerProcessor.java View 1 2 3 4 5 6 7 8 1 chunk +25 lines, -0 lines 0 comments Download
M chrome/browser/android/offline_pages/background_scheduler_bridge.cc View 1 2 3 4 5 6 2 chunks +2 lines, -3 lines 0 comments Download
M components/offline_pages/background/request_coordinator.h View 1 2 3 4 5 6 7 8 9 2 chunks +1 line, -2 lines 0 comments Download
M components/offline_pages/background/request_coordinator.cc View 1 2 3 4 5 6 7 8 9 3 chunks +3 lines, -1 line 0 comments Download
M components/offline_pages/background/request_coordinator_unittest.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M components/offline_pages/background/request_picker.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 68 (27 generated)
Pete Williamson
4 years, 6 months ago (2016-06-01 23:41:10 UTC) #2
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2030773002/1
4 years, 6 months ago (2016-06-01 23:47:21 UTC) #5
dougarnett
Few preliminary comments - I haven't gotten very far into it yet. https://codereview.chromium.org/2030773002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java File chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java ...
4 years, 6 months ago (2016-06-02 00:14:45 UTC) #6
chili
Sorry for jumping in with comments. I'm trying to keep on top of changes for ...
4 years, 6 months ago (2016-06-02 00:37:25 UTC) #8
Pete Williamson
https://codereview.chromium.org/2030773002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java File chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java (right): https://codereview.chromium.org/2030773002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java#newcode129 chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java:129: @VisibleForTesting On 2016/06/02 00:14:45, dougarnett wrote: > ? but ...
4 years, 6 months ago (2016-06-02 00:42:06 UTC) #9
dougarnett
few more comments from bouncy shuttle ... https://codereview.chromium.org/2030773002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java#newcode45 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java:45: public interface ...
4 years, 6 months ago (2016-06-02 16:31:47 UTC) #10
Pete Williamson
I removed the ChromeBackgroundService test, which seems to be failing when I call SystemClock.elapsedRealtime() when ...
4 years, 6 months ago (2016-06-02 20:51:33 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2030773002/40001
4 years, 6 months ago (2016-06-02 20:55:23 UTC) #13
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/240403)
4 years, 6 months ago (2016-06-03 00:05:18 UTC) #15
dougarnett
https://codereview.chromium.org/2030773002/diff/20001/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/ShadowGcmNetworkManager.java File chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/ShadowGcmNetworkManager.java (right): https://codereview.chromium.org/2030773002/diff/20001/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/ShadowGcmNetworkManager.java#newcode19 chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/ShadowGcmNetworkManager.java:19: public class ShadowGcmNetworkManager { On 2016/06/02 20:51:33, Pete Williamson ...
4 years, 6 months ago (2016-06-03 16:58:00 UTC) #16
Pete Williamson
Addressed most of DougArnett's feedback, we are still working on whether we need a new ...
4 years, 6 months ago (2016-06-03 21:05:58 UTC) #17
dewittj
drive-by! https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java (right): https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java#newcode43 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java:43: .setPersisted(true) This should be done in a separate ...
4 years, 6 months ago (2016-06-03 21:21:50 UTC) #19
chili
https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java#newcode12 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java:12: // started and that caller should expect a callback ...
4 years, 6 months ago (2016-06-03 21:24:17 UTC) #21
dougarnett
Just some naming suggestions https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java (right): https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java#newcode39 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java:39: long millisTaskStart = TaskExtrasPacker.unpackTimeFromBundle(bundle); usually ...
4 years, 6 months ago (2016-06-03 21:51:54 UTC) #22
Pete Williamson
CR feedback per DewittJ and Chili. (None for DougArnett yet) https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java (right): https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java#newcode43 ...
4 years, 6 months ago (2016-06-03 22:14:18 UTC) #23
Pete Williamson
CR fixes per DougArnett https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java (right): https://codereview.chromium.org/2030773002/diff/60001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java#newcode39 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTask.java:39: long millisTaskStart = TaskExtrasPacker.unpackTimeFromBundle(bundle); On ...
4 years, 6 months ago (2016-06-03 23:52:29 UTC) #24
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/100001
4 years, 6 months ago (2016-06-03 23:53:23 UTC) #26
dougarnett
lgtm
4 years, 6 months ago (2016-06-04 00:06:49 UTC) #27
Pete Williamson
BauerB: Please review changes to ChromeBackgroundScheduler.java and how we set up the BackgroundSchedulerBridge for testing. ...
4 years, 6 months ago (2016-06-04 00:14:34 UTC) #29
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-04 01:11:35 UTC) #31
Bernhard Bauer
https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java#newcode52 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java:52: @CalledByNative("ProcessingDoneCallback") So, the "proper" way to do this would ...
4 years, 6 months ago (2016-06-06 15:43:32 UTC) #33
Pete Williamson
https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java#newcode52 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java:52: @CalledByNative("ProcessingDoneCallback") On 2016/06/06 15:43:32, Bernhard Bauer wrote: > So, ...
4 years, 6 months ago (2016-06-07 00:20:22 UTC) #34
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/120001
4 years, 6 months ago (2016-06-07 00:21:02 UTC) #36
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/82906)
4 years, 6 months ago (2016-06-07 01:40:32 UTC) #38
Bernhard Bauer
https://codereview.chromium.org/2030773002/diff/120001/chrome/browser/android/offline_pages/background_scheduler_bridge.cc File chrome/browser/android/offline_pages/background_scheduler_bridge.cc (right): https://codereview.chromium.org/2030773002/diff/120001/chrome/browser/android/offline_pages/background_scheduler_bridge.cc#newcode25 chrome/browser/android/offline_pages/background_scheduler_bridge.cc:25: base::android::RunCallbackAndroid(j_callback_obj, result); Wait, does this work when |j_callback_obj| is ...
4 years, 6 months ago (2016-06-07 08:43:42 UTC) #39
dougarnett
https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java#newcode10 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java:10: public interface SchedulerBridge { On 2016/06/07 00:20:22, Pete Williamson ...
4 years, 6 months ago (2016-06-07 15:57:25 UTC) #40
Pete Williamson
Renamed the SchedulerRequestProcessor to BackgroundSchedulerProcessor per DougArnett. Replaced the ProcessingDoneCallback on the Java side with ...
4 years, 6 months ago (2016-06-07 22:04:12 UTC) #41
Pete Williamson
https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java (right): https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java#newcode10 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java:10: public interface SchedulerBridge { On 2016/06/07 15:57:25, dougarnett wrote: ...
4 years, 6 months ago (2016-06-07 22:10:34 UTC) #42
dougarnett
On 2016/06/07 22:10:34, Pete Williamson wrote: > https://codereview.chromium.org/2030773002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java > File > chrome/android/java/src/org/chromium/chrome/browser/offlinepages/interfaces/SchedulerBridge.java > (right): > ...
4 years, 6 months ago (2016-06-07 22:24:43 UTC) #43
Bernhard Bauer
LGTM, just some small stuff: https://codereview.chromium.org/2030773002/diff/160001/components/offline_pages/background/request_coordinator.h File components/offline_pages/background/request_coordinator.h (right): https://codereview.chromium.org/2030773002/diff/160001/components/offline_pages/background/request_coordinator.h#newcode32 components/offline_pages/background/request_coordinator.h:32: typedef base::Callback<void()> ProcessingDoneCallback; Is ...
4 years, 6 months ago (2016-06-08 14:09:29 UTC) #44
Pete Williamson
https://codereview.chromium.org/2030773002/diff/160001/components/offline_pages/background/request_coordinator.h File components/offline_pages/background/request_coordinator.h (right): https://codereview.chromium.org/2030773002/diff/160001/components/offline_pages/background/request_coordinator.h#newcode32 components/offline_pages/background/request_coordinator.h:32: typedef base::Callback<void()> ProcessingDoneCallback; On 2016/06/08 14:09:29, Bernhard Bauer wrote: ...
4 years, 6 months ago (2016-06-08 17:43:28 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/180001
4 years, 6 months ago (2016-06-08 17:43:54 UTC) #48
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/226632)
4 years, 6 months ago (2016-06-08 18:56:31 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/180001
4 years, 6 months ago (2016-06-08 19:19:41 UTC) #52
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/84279)
4 years, 6 months ago (2016-06-08 21:00:50 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/200001
4 years, 6 months ago (2016-06-08 21:09:44 UTC) #57
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/220001
4 years, 6 months ago (2016-06-08 22:31:21 UTC) #60
commit-bot: I haz the power
Try jobs failed on following builders: win_clang on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_clang/builds/34854)
4 years, 6 months ago (2016-06-08 22:41:31 UTC) #62
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2030773002/220001
4 years, 6 months ago (2016-06-08 22:53:54 UTC) #64
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 6 months ago (2016-06-08 23:53:58 UTC) #66
commit-bot: I haz the power
4 years, 6 months ago (2016-06-08 23:55:20 UTC) #68
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/36efc4e2983393cb9a92fc35c7656a31e932da59
Cr-Commit-Position: refs/heads/master@{#398738}

Powered by Google App Engine
This is Rietveld 408576698