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

Unified Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java

Issue 2781583002: [Content suggestions] Add a function to the service API to fetch favicons (Closed)
Patch Set: Expand the FakeSuggestionsSource Created 3 years, 9 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/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java
index b2969cadbb0cf229382cdc2751a2b43bf0a49a20..45f93050a9370c8ecbc1e3c401e2fb93c7bb0abc 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/suggestions/FakeSuggestionsSource.java
@@ -32,6 +32,7 @@ public class FakeSuggestionsSource implements SuggestionsSource {
private final Map<Integer, Integer> mCategoryStatus = new LinkedHashMap<>();
private final Map<Integer, SuggestionsCategoryInfo> mCategoryInfo = new HashMap<>();
private final Map<String, Bitmap> mThumbnails = new HashMap<>();
+ private final Map<String, Bitmap> mFavicons = new HashMap<>();
Michael van Ouwerkerk 2017/03/28 11:23:56 Please document what the String represents.
jkrcal 2017/03/28 13:12:53 Done.
private final List<Integer> mDismissedCategories = new ArrayList<>();
private final Map<Integer, List<SnippetArticle>> mDismissedCategorySuggestions =
@@ -77,6 +78,13 @@ public class FakeSuggestionsSource implements SuggestionsSource {
}
/**
+ * Sets the bitmap to be returned when the favicon is requested for a snippet with that id.
Michael van Ouwerkerk 2017/03/28 11:23:56 We're trying to move away from this use of the wor
jkrcal 2017/03/28 13:12:53 Done.
+ */
+ public void setFaviconForId(String id, Bitmap bitmap) {
+ mFavicons.put(id, bitmap);
+ }
+
+ /**
* Removes the given suggestion from the source and notifies any observer that it has been
* invalidated.
*/
@@ -145,6 +153,14 @@ public class FakeSuggestionsSource implements SuggestionsSource {
}
@Override
+ public void fetchSuggestionFavicon(SnippetArticle suggestion, int minimumSizeInPixel,
+ int desiredSizeInPixel, Callback<Bitmap> callback) {
+ if (mFavicons.containsKey(suggestion.mIdWithinCategory)) {
+ callback.onResult(mFavicons.get(suggestion.mIdWithinCategory));
Michael van Ouwerkerk 2017/03/28 11:23:56 The documentation for fetchSuggestionFavicon expli
jkrcal 2017/03/28 13:12:53 Done.
+ }
+ }
+
+ @Override
public void fetchSuggestions(@CategoryInt int category, String[] displayedSuggestionIds) {
throw new UnsupportedOperationException();
}

Powered by Google App Engine
This is Rietveld 408576698