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(); |
} |