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

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

Issue 2819763002: Add end-to-end test for CopylessPaste (Closed)
Patch Set: split tests Created 3 years, 8 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/BUILD.gn ('k') | chrome/android/java_sources.gni » ('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/AppIndexingUtil.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppIndexingUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/AppIndexingUtil.java
index 8b54604ab13c7e9220ca7503d22ecee06abd24b3..f0398fc37324fec487b7c25f2113939fbe54ab3f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/AppIndexingUtil.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/AppIndexingUtil.java
@@ -8,6 +8,7 @@ import android.os.SystemClock;
import android.util.LruCache;
import android.webkit.URLUtil;
+import org.chromium.base.Callback;
import org.chromium.base.SysUtils;
import org.chromium.base.VisibleForTesting;
import org.chromium.blink.mojom.document_metadata.CopylessPaste;
@@ -29,6 +30,8 @@ public class AppIndexingUtil {
// and instead just report the view (not the content) to App Indexing.
private LruCache<String, CacheEntry> mPageCache;
+ private static Callback<WebPage> sCallbackForTesting;
+
/**
* Extracts entities from document metadata and reports it to on-device App Indexing.
* This call can cache entities from recently parsed webpages, in which case, only the url and
@@ -62,6 +65,9 @@ public class AppIndexingUtil {
@Override
public void call(WebPage webpage) {
putCacheEntry(url, webpage != null);
+ if (sCallbackForTesting != null) {
+ sCallbackForTesting.onResult(webpage);
+ }
if (webpage == null) return;
getAppIndexingReporter().reportWebPage(webpage);
}
@@ -69,6 +75,11 @@ public class AppIndexingUtil {
}
}
+ @VisibleForTesting
+ public static void setCallbackForTesting(Callback<WebPage> callback) {
+ sCallbackForTesting = callback;
+ }
+
private boolean wasPageVisitedRecently(String url) {
if (url == null) {
return false;
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698