| OLD | NEW |
| (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 } |
| OLD | NEW |