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.assertEquals; | 7 import static org.junit.Assert.assertEquals; |
8 import static org.junit.Assert.assertFalse; | 8 import static org.junit.Assert.assertFalse; |
9 import static org.junit.Assert.assertNotNull; | 9 import static org.junit.Assert.assertNotNull; |
10 import static org.junit.Assert.assertNull; | 10 import static org.junit.Assert.assertNull; |
(...skipping 19 matching lines...) Expand all Loading... |
30 import org.chromium.base.ActivityState; | 30 import org.chromium.base.ActivityState; |
31 import org.chromium.base.ApplicationStatus; | 31 import org.chromium.base.ApplicationStatus; |
32 import org.chromium.base.BaseChromiumApplication; | 32 import org.chromium.base.BaseChromiumApplication; |
33 import org.chromium.base.BaseSwitches; | 33 import org.chromium.base.BaseSwitches; |
34 import org.chromium.base.CommandLine; | 34 import org.chromium.base.CommandLine; |
35 import org.chromium.base.SysUtils; | 35 import org.chromium.base.SysUtils; |
36 import org.chromium.base.test.util.Feature; | 36 import org.chromium.base.test.util.Feature; |
37 import org.chromium.chrome.browser.ChromeBackgroundServiceWaiter; | 37 import org.chromium.chrome.browser.ChromeBackgroundServiceWaiter; |
38 import org.chromium.chrome.browser.DisableHistogramsRule; | 38 import org.chromium.chrome.browser.DisableHistogramsRule; |
39 import org.chromium.net.ConnectionType; | 39 import org.chromium.net.ConnectionType; |
| 40 import org.chromium.testing.local.LocalRobolectricTestRunner; |
40 | 41 |
41 /** | 42 /** |
42 * Unit tests for BackgroundOfflinerTask. | 43 * Unit tests for BackgroundOfflinerTask. |
43 */ | 44 */ |
44 @RunWith(OfflinePageTestRunner.class) | 45 @RunWith(LocalRobolectricTestRunner.class) |
45 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class, | 46 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class, sdk
= 21, |
46 shadows = {ShadowGcmNetworkManager.class, ShadowGoogleApiAvailability.cl
ass, | 47 shadows = {ShadowGcmNetworkManager.class, ShadowGoogleApiAvailability.cl
ass, |
47 ShadowDeviceConditions.class}) | 48 ShadowDeviceConditions.class}) |
48 public class BackgroundOfflinerTaskTest { | 49 public class BackgroundOfflinerTaskTest { |
49 private static final boolean REQUIRE_POWER = true; | 50 private static final boolean REQUIRE_POWER = true; |
50 private static final boolean REQUIRE_UNMETERED = true; | 51 private static final boolean REQUIRE_UNMETERED = true; |
51 private static final boolean POWER_CONNECTED = true; | 52 private static final boolean POWER_CONNECTED = true; |
52 private static final int MINIMUM_BATTERY_LEVEL = 33; | 53 private static final int MINIMUM_BATTERY_LEVEL = 33; |
53 private static final String IS_LOW_END_DEVICE_SWITCH = | 54 private static final String IS_LOW_END_DEVICE_SWITCH = |
54 "--" + BaseSwitches.ENABLE_LOW_END_DEVICE_MODE; | 55 "--" + BaseSwitches.ENABLE_LOW_END_DEVICE_MODE; |
55 | 56 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); | 214 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); |
214 ChromeBackgroundServiceWaiter waiter2 = new ChromeBackgroundServiceWaite
r(1); | 215 ChromeBackgroundServiceWaiter waiter2 = new ChromeBackgroundServiceWaite
r(1); |
215 task2.startBackgroundRequests(RuntimeEnvironment.application, mTaskExtra
s, waiter2); | 216 task2.startBackgroundRequests(RuntimeEnvironment.application, mTaskExtra
s, waiter2); |
216 | 217 |
217 assertTrue(mStubBackgroundSchedulerProcessor.getDidStartProcessing()); | 218 assertTrue(mStubBackgroundSchedulerProcessor.getDidStartProcessing()); |
218 | 219 |
219 mStubBackgroundSchedulerProcessor.callback(); | 220 mStubBackgroundSchedulerProcessor.callback(); |
220 waiter2.startWaiting(); | 221 waiter2.startWaiting(); |
221 } | 222 } |
222 } | 223 } |
OLD | NEW |