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

Side by Side Diff: chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java

Issue 2030773002: Add unit tests for the Background Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR fixes per BauerB Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.offlinepages;
6
7 import static org.junit.Assert.assertTrue;
8
9 import android.os.Bundle;
10
11 import org.chromium.base.BaseChromiumApplication;
12 import org.chromium.base.test.util.Feature;
13 import org.chromium.testing.local.LocalRobolectricTestRunner;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17 import org.robolectric.annotation.Config;
18
19 /**
20 * Unit tests for BackgroundOfflinerTask.
21 */
22 @RunWith(LocalRobolectricTestRunner.class)
23 @Config(manifest = Config.NONE,
24 application = BaseChromiumApplication.class)
25 public class BackgroundOfflinerTaskTest {
26 private Bundle mTaskExtras;
27 private long mTestTime;
28 private StubSchedulerRequestProcessor mStubSchedulerRequestProcessor;
29
30 @Before
31 public void setUp() throws Exception {
32 // Build a bundle
33 mTaskExtras = new Bundle();
34 TaskExtrasPacker.packTimeInBundle(mTaskExtras);
35 mStubSchedulerRequestProcessor = new StubSchedulerRequestProcessor();
36 }
37
38 @Test
39 @Feature({"OfflinePages"})
40 public void testIncomingTask() {
41 BackgroundOfflinerTask task =
42 new BackgroundOfflinerTask(mStubSchedulerRequestProcessor);
43 task.processBackgroundRequests(mTaskExtras);
44 // Call onProcessingDone here to make sure the code path is covered by a test.
45 // This will likely move to its own test later as we add more implementa tion.
46 task.onProcessingDone(true);
47
48 // Check with ShadowBackgroundSchedulerRequestProcessor that startProces sing got called.
49 assertTrue(mStubSchedulerRequestProcessor.getStartProcessingCalled());
50 }
51
52 @Test
53 @Feature({"OfflinePages"})
54 public void testOnProcessingDone() {
55 // TODO(petewil): Implement the test
56 }
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698