| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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.chrome.browser.offlinepages; | 5 package org.chromium.chrome.browser.offlinepages; |
| 6 | 6 |
| 7 import static org.junit.Assert.assertTrue; | 7 import static org.junit.Assert.assertTrue; |
| 8 | 8 |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 | 10 |
| 11 import org.chromium.base.BaseChromiumApplication; | 11 import org.chromium.base.BaseChromiumApplication; |
| 12 import org.chromium.base.test.util.Feature; | 12 import org.chromium.base.test.util.Feature; |
| 13 import org.chromium.net.ConnectionType; |
| 13 import org.chromium.testing.local.LocalRobolectricTestRunner; | 14 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 14 import org.junit.Before; | 15 import org.junit.Before; |
| 15 import org.junit.Test; | 16 import org.junit.Test; |
| 16 import org.junit.runner.RunWith; | 17 import org.junit.runner.RunWith; |
| 17 import org.robolectric.annotation.Config; | 18 import org.robolectric.annotation.Config; |
| 18 | 19 |
| 19 /** | 20 /** |
| 20 * Unit tests for BackgroundOfflinerTask. | 21 * Unit tests for BackgroundOfflinerTask. |
| 21 */ | 22 */ |
| 22 @RunWith(LocalRobolectricTestRunner.class) | 23 @RunWith(LocalRobolectricTestRunner.class) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 mTaskExtras = new Bundle(); | 34 mTaskExtras = new Bundle(); |
| 34 TaskExtrasPacker.packTimeInBundle(mTaskExtras); | 35 TaskExtrasPacker.packTimeInBundle(mTaskExtras); |
| 35 mStubBackgroundSchedulerProcessor = new StubBackgroundSchedulerProcessor
(); | 36 mStubBackgroundSchedulerProcessor = new StubBackgroundSchedulerProcessor
(); |
| 36 } | 37 } |
| 37 | 38 |
| 38 @Test | 39 @Test |
| 39 @Feature({"OfflinePages"}) | 40 @Feature({"OfflinePages"}) |
| 40 public void testIncomingTask() { | 41 public void testIncomingTask() { |
| 41 BackgroundOfflinerTask task = | 42 BackgroundOfflinerTask task = |
| 42 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); | 43 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); |
| 43 task.processBackgroundRequests(mTaskExtras); | 44 DeviceConditions deviceConditions = |
| 45 new DeviceConditions(false, 51, ConnectionType.CONNECTION_WIFI); |
| 46 task.processBackgroundRequests(mTaskExtras, deviceConditions); |
| 44 | 47 |
| 45 // Check with ShadowBackgroundBackgroundSchedulerProcessor that startPro
cessing got called. | 48 // Check with ShadowBackgroundBackgroundSchedulerProcessor that startPro
cessing got called. |
| 46 assertTrue(mStubBackgroundSchedulerProcessor.getStartProcessingCalled())
; | 49 assertTrue(mStubBackgroundSchedulerProcessor.getStartProcessingCalled())
; |
| 47 } | 50 } |
| 48 | 51 |
| 49 @Test | 52 @Test |
| 50 @Feature({"OfflinePages"}) | 53 @Feature({"OfflinePages"}) |
| 51 public void testCallback() { | 54 public void testCallback() { |
| 52 // TODO(petewil): Implement the test | 55 // TODO(petewil): Implement the test |
| 53 } | 56 } |
| 54 } | 57 } |
| OLD | NEW |