| Index: chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java
|
| index 4c37b57d8f423f13d208e179dcbcd71746e001bf..0303362a59def5655894c21f59c07f23e103525d 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java
|
| @@ -26,12 +26,14 @@
|
| import org.chromium.chrome.browser.ntp.NewTabPage.DestructionObserver;
|
| import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
|
| import org.chromium.chrome.browser.ntp.UiConfig;
|
| +import org.chromium.chrome.browser.ntp.cards.ActionItem;
|
| import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter;
|
| import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView;
|
| import org.chromium.chrome.browser.ntp.cards.SuggestionsCategoryInfo;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
| import org.chromium.chrome.browser.profiles.MostVisitedSites.MostVisitedURLsObserver;
|
| import org.chromium.chrome.browser.profiles.Profile;
|
| +import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter;
|
| import org.chromium.chrome.test.ChromeActivityTestCaseBase;
|
| import org.chromium.chrome.test.util.RenderUtils.ViewRenderer;
|
|
|
| @@ -136,8 +138,7 @@ private void setupTestData() {
|
| "Preview Text",
|
| "www.google.com",
|
| 1466614774, // Timestamp
|
| - 10f, // Score
|
| - 0); // Position
|
| + 10f); // Score
|
| shortSnippet.setThumbnailBitmap(BitmapFactory.decodeResource(getActivity().getResources(),
|
| R.drawable.signin_promo_illustration));
|
|
|
| @@ -149,8 +150,7 @@ private void setupTestData() {
|
| new String(new char[80]).replace("\0", "Preview Text "),
|
| "www.google.com",
|
| 1466614074, // Timestamp
|
| - 20f, // Score
|
| - 1); // Position
|
| + 20f); // Score
|
|
|
| SnippetArticle minimalSnippet = new SnippetArticle(
|
| minimalCategory,
|
| @@ -160,8 +160,7 @@ private void setupTestData() {
|
| "This should not be displayed",
|
| "www.google.com",
|
| 1466614774, // Timestamp
|
| - 10f, // Score
|
| - 0); // Position
|
| + 10f); // Score
|
|
|
| SnippetArticle minimalSnippet2 = new SnippetArticle(
|
| minimalCategory,
|
| @@ -171,8 +170,7 @@ private void setupTestData() {
|
| "This should not be displayed",
|
| "www.google.com",
|
| 1466614774, // Timestamp
|
| - 10f, // Score
|
| - 0); // Position
|
| + 10f); // Score
|
|
|
| mSnippetsSource.setInfoForCategory(
|
| fullCategory, new SuggestionsCategoryInfo(fullCategory, "Section Title",
|
| @@ -212,6 +210,8 @@ protected void setUp() throws Exception {
|
| // TODO(dgn): provide a RecyclerView if we need to test the context menu.
|
| private ContextMenuManager mContextMenuManager =
|
| new ContextMenuManager(getActivity(), this, null);
|
| + private SuggestionsMetricsReporter mSuggestionsMetricsReporter =
|
| + new DummySuggestionsMetricsReporter();
|
|
|
| @Override
|
| public void getLocalFaviconImageForURL(
|
| @@ -265,21 +265,6 @@ public void navigateToRecentTabs() {
|
| }
|
|
|
| @Override
|
| - public void trackSnippetsPageImpression(int[] categories, int[] suggestionsPerCategory) {}
|
| -
|
| - @Override
|
| - public void trackSnippetImpression(SnippetArticle article) {}
|
| -
|
| - @Override
|
| - public void trackSnippetMenuOpened(SnippetArticle article) {}
|
| -
|
| - @Override
|
| - public void trackSnippetCategoryActionImpression(int category, int position) {}
|
| -
|
| - @Override
|
| - public void trackSnippetCategoryActionClick(int category, int position) {}
|
| -
|
| - @Override
|
| public void openSnippet(int windowOpenDisposition, SnippetArticle article) {
|
| throw new UnsupportedOperationException();
|
| }
|
| @@ -362,5 +347,29 @@ public boolean isCurrentPage() {
|
| public ContextMenuManager getContextMenuManager() {
|
| return mContextMenuManager;
|
| }
|
| +
|
| + public SuggestionsMetricsReporter getSuggestionsMetricsReporter() {
|
| + return mSuggestionsMetricsReporter;
|
| + }
|
| + }
|
| +
|
| + private static class DummySuggestionsMetricsReporter implements SuggestionsMetricsReporter {
|
| + @Override
|
| + public void onPageShown(int[] categories, int[] suggestionsPerCategory) {}
|
| +
|
| + @Override
|
| + public void onSuggestionShown(SnippetArticle suggestion) {}
|
| +
|
| + @Override
|
| + public void onSuggestionOpened(SnippetArticle suggestion, int windowOpenDisposition) {}
|
| +
|
| + @Override
|
| + public void onSuggestionMenuOpened(SnippetArticle suggestion) {}
|
| +
|
| + @Override
|
| + public void onMoreButtonShown(@CategoryInt ActionItem category) {}
|
| +
|
| + @Override
|
| + public void onMoreButtonClicked(@CategoryInt ActionItem category) {}
|
| }
|
| }
|
|
|