| 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;
|
|
|