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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java

Issue 615843004: Make hasCookieStoreLoaded visible for testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switched to using another threadUtils API Created 6 years, 2 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 | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderRequestTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
index b96062e9f402c018c11fa641e0064fffa088dd65..e604aa4c4800b27618961d787503cce55026621b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.prerender;
import org.chromium.base.JNINamespace;
+import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.browser.ContentViewUtil;
import org.chromium.chrome.browser.profiles.Profile;
@@ -20,6 +21,15 @@ public class ExternalPrerenderHandler {
mNativeExternalPrerenderHandler = nativeInit();
}
+ /**
+ * Add a prerender for the given url and given content view dimensions.
+ * @param profile The profile to use for the prerender.
+ * @param url The url to prerender.
+ * @param referrer The referrer for the prerender request.
+ * @param width The width for the content view (render widget host view) for the prerender.
+ * @param height The height for the content view (render widget host view) for the prerender.
+ * @return The native web contents pointer that is linked to this prerender. 0 if unsuccessful.
+ */
public long addPrerender(Profile profile, String url, String referrer, int width, int height) {
long webContentsPtr = ContentViewUtil.createNativeWebContents(false);
if (nativeAddPrerender(mNativeExternalPrerenderHandler, profile, webContentsPtr,
@@ -30,15 +40,33 @@ public class ExternalPrerenderHandler {
return 0;
}
+ /**
+ * Cancel the current prerender action on this {@link ExternalPrerenderHandler}.
+ */
public void cancelCurrentPrerender() {
nativeCancelCurrentPrerender(mNativeExternalPrerenderHandler);
}
+ /**
+ * Check whether a given url has been prerendering for the given profile and session id for the
+ * given web contents.
+ * @param profile The profile to check for prerendering.
+ * @param url The url to check for prerender.
+ * @param webContentsPtr The native pointer for which to compare the session info.
+ * @return Whether the given url was prerendered.
+ */
public static boolean hasPrerenderedUrl(Profile profile, String url, long webContentsPtr) {
return nativeHasPrerenderedUrl(profile, url, webContentsPtr);
}
- public static boolean hasCookieStoreLoaded(Profile profile) {
+ /**
+ * Check whether the cookie store has been loaded. This is needed for prerender manager to allow
+ * to add prerenders and this call is to be used to wait until that happens in tests.
+ * @param profile The profile to be used.
+ * @return Whether the cookie store has been loaded.
+ */
+ @VisibleForTesting
+ public static boolean checkCookieStoreLoadedForTesting(Profile profile) {
return nativeHasCookieStoreLoaded(profile);
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderRequestTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698