| 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 23 matching lines...) Expand all Loading... |
| 34 import org.chromium.base.ActivityState; | 34 import org.chromium.base.ActivityState; |
| 35 import org.chromium.base.ApplicationStatus; | 35 import org.chromium.base.ApplicationStatus; |
| 36 import org.chromium.base.BaseChromiumApplication; | 36 import org.chromium.base.BaseChromiumApplication; |
| 37 import org.chromium.base.BaseSwitches; | 37 import org.chromium.base.BaseSwitches; |
| 38 import org.chromium.base.CommandLine; | 38 import org.chromium.base.CommandLine; |
| 39 import org.chromium.base.SysUtils; | 39 import org.chromium.base.SysUtils; |
| 40 import org.chromium.base.test.util.Feature; | 40 import org.chromium.base.test.util.Feature; |
| 41 import org.chromium.chrome.browser.ChromeBackgroundServiceWaiter; | 41 import org.chromium.chrome.browser.ChromeBackgroundServiceWaiter; |
| 42 import org.chromium.chrome.browser.DisableHistogramsRule; | 42 import org.chromium.chrome.browser.DisableHistogramsRule; |
| 43 import org.chromium.net.ConnectionType; | 43 import org.chromium.net.ConnectionType; |
| 44 import org.chromium.testing.local.LocalRobolectricTestRunner; |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * Unit tests for BackgroundOfflinerTask. | 47 * Unit tests for BackgroundOfflinerTask. |
| 47 */ | 48 */ |
| 48 @RunWith(OfflinePageTestRunner.class) | 49 @RunWith(LocalRobolectricTestRunner.class) |
| 49 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class, | 50 @Config(manifest = Config.NONE, application = BaseChromiumApplication.class, |
| 50 shadows = {ShadowGcmNetworkManager.class, ShadowGoogleApiAvailability.cl
ass}) | 51 shadows = {ShadowGcmNetworkManager.class, ShadowGoogleApiAvailability.cl
ass}) |
| 51 public class BackgroundOfflinerTaskTest { | 52 public class BackgroundOfflinerTaskTest { |
| 52 private static final boolean REQUIRE_POWER = true; | 53 private static final boolean REQUIRE_POWER = true; |
| 53 private static final boolean REQUIRE_UNMETERED = true; | 54 private static final boolean REQUIRE_UNMETERED = true; |
| 54 private static final boolean POWER_CONNECTED = true; | 55 private static final boolean POWER_CONNECTED = true; |
| 55 private static final int MINIMUM_BATTERY_LEVEL = 33; | 56 private static final int MINIMUM_BATTERY_LEVEL = 33; |
| 56 private static final String IS_LOW_END_DEVICE_SWITCH = | 57 private static final String IS_LOW_END_DEVICE_SWITCH = |
| 57 "--" + BaseSwitches.ENABLE_LOW_END_DEVICE_MODE; | 58 "--" + BaseSwitches.ENABLE_LOW_END_DEVICE_MODE; |
| 58 | 59 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); | 225 new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor); |
| 225 ChromeBackgroundServiceWaiter waiter2 = new ChromeBackgroundServiceWaite
r(1); | 226 ChromeBackgroundServiceWaiter waiter2 = new ChromeBackgroundServiceWaite
r(1); |
| 226 task2.startBackgroundRequests(RuntimeEnvironment.application, mTaskExtra
s, waiter2); | 227 task2.startBackgroundRequests(RuntimeEnvironment.application, mTaskExtra
s, waiter2); |
| 227 | 228 |
| 228 assertTrue(mStubBackgroundSchedulerProcessor.getDidStartProcessing()); | 229 assertTrue(mStubBackgroundSchedulerProcessor.getDidStartProcessing()); |
| 229 | 230 |
| 230 mStubBackgroundSchedulerProcessor.callback(); | 231 mStubBackgroundSchedulerProcessor.callback(); |
| 231 waiter2.startWaiting(); | 232 waiter2.startWaiting(); |
| 232 } | 233 } |
| 233 } | 234 } |
| OLD | NEW |