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

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

Issue 2030773002: Add unit tests for the Background Scheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
index aaf8ab98679adbaaa455989eb55112c2c0a3b65b..1ed1da3bc375a6499b321c65a4fb753b3c9a0e2a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.offlinepages;
import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import org.chromium.chrome.browser.offlinepages.interfaces.SchedulerBridgeInterface;
/**
* Provides Java scheduling support from native offlining code as
@@ -15,14 +16,6 @@ import org.chromium.base.annotations.JNINamespace;
*/
@JNINamespace("offline_pages::android")
public class BackgroundSchedulerBridge {
- /**
- * Callback used to determine when request processing is done.
- */
- public interface ProcessingDoneCallback {
- @CalledByNative("ProcessingDoneCallback")
- void onProcessingDone(boolean result);
- }
-
// Starts processing of one or more queued background requests.
// Returns whether processing was started and that caller should
// expect a callback (once processing has completed or terminated).
@@ -31,7 +24,8 @@ public class BackgroundSchedulerBridge {
// not receive a callback.
// TODO(dougarnett): consider adding policy check api to let caller
// separately determine if not allowed by policy.
- public static boolean startProcessing(ProcessingDoneCallback callback) {
+ public static boolean startProcessing(
+ SchedulerBridgeInterface.ProcessingDoneCallback callback) {
return nativeStartProcessing(callback);
}
@@ -45,5 +39,14 @@ public class BackgroundSchedulerBridge {
BackgroundScheduler.unschedule(ContextUtils.getApplicationContext());
}
- private static native boolean nativeStartProcessing(ProcessingDoneCallback callback);
+ /**
+ * Callback used to determine when request processing is done.
+ */
+ public interface ProcessingDoneCallback {
dougarnett 2016/06/02 00:14:45 hmm, confusing to have same name for two interface
Pete Williamson 2016/06/02 00:42:06 Agreed, I'm playing tricks with JNI. JNI needs to
dougarnett 2016/06/02 16:31:47 Yes, please try to document here.
Pete Williamson 2016/06/02 20:51:33 Comment expanded.
+ @CalledByNative("ProcessingDoneCallback")
+ void onProcessingDone(boolean result);
+ }
+
+ private static native boolean nativeStartProcessing(
+ SchedulerBridgeInterface.ProcessingDoneCallback callback);
}

Powered by Google App Engine
This is Rietveld 408576698