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

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

Issue 2073993003: Performs saftey schedule of another task in BackgroundOfflinerTask in case processing killed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java
index 571ade12ce4feeb63eddb1952a3a6051b7de46b3..c677f134fd70d5b86316b4041dd0b6e4e12dee55 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/offlinepages/BackgroundOfflinerTaskTest.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.offlinepages;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -17,6 +19,7 @@ import org.chromium.testing.local.LocalRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
/**
@@ -24,7 +27,8 @@ import org.robolectric.annotation.Config;
*/
@RunWith(LocalRobolectricTestRunner.class)
@Config(manifest = Config.NONE,
- application = BaseChromiumApplication.class)
+ application = BaseChromiumApplication.class,
+ shadows = { ShadowGcmNetworkManager.class })
public class BackgroundOfflinerTaskTest {
private Bundle mTaskExtras;
private long mTestTime;
@@ -57,6 +61,21 @@ public class BackgroundOfflinerTaskTest {
@Test
@Feature({"OfflinePages"})
+ public void testStartBackgroundRequests() {
+ BackgroundOfflinerTask task = new BackgroundOfflinerTask(mStubBackgroundSchedulerProcessor);
+ ChromeBackgroundServiceWaiter waiter = new ChromeBackgroundServiceWaiter(1);
+ assertNull("Nothing scheduled", ShadowGcmNetworkManager.getScheduledTask());
+ assertTrue(task.startBackgroundRequests(Robolectric.application, mTaskExtras, waiter));
+
+ // Check that the backup task was scheduled.
+ assertNotNull("Backup task scheduled", ShadowGcmNetworkManager.getScheduledTask());
+
+ // Check with ShadowBackgroundBackgroundSchedulerProcessor that startProcessing got called.
+ assertTrue(mStubBackgroundSchedulerProcessor.getStartProcessingCalled());
+ }
+
+ @Test
+ @Feature({"OfflinePages"})
public void testCallback() {
// TODO(petewil): Implement the test
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698