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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java

Issue 2623993007: 🏠 Extract the ContentSuggestionManager interface from NTP (Closed)
Patch Set: fix destruction of snippets bridge Created 3 years, 11 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/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java
index 0993d08bae28d38f8d2f54eb3a37c4c5bb6c60c8..8145e3e1aa73527c54a59ef5f40365fbc79136bf 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java
@@ -22,7 +22,6 @@
import org.chromium.base.Callback;
import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
import org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.CategoryInfoBuilder;
import org.chromium.chrome.browser.ntp.snippets.FakeSuggestionsSource;
import org.chromium.chrome.browser.ntp.snippets.KnownCategories;
@@ -30,6 +29,7 @@
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter;
import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter.SuggestionRanker;
+import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
import org.chromium.testing.local.LocalRobolectricTestRunner;
import java.util.List;
@@ -41,7 +41,7 @@
@Config(manifest = Config.NONE)
public class SectionListTest {
@Mock
- private NewTabPageManager mNtpManager;
+ private SuggestionsUiDelegate mUiDelegate;
@Mock
private OfflinePageBridge mOfflinePageBridge;
@Mock
@@ -53,8 +53,8 @@ public void setUp() {
MockitoAnnotations.initMocks(this);
mSuggestionSource = new FakeSuggestionsSource();
- when(mNtpManager.getSuggestionsSource()).thenReturn(mSuggestionSource);
- when(mNtpManager.getSuggestionsMetricsReporter()).thenReturn(mMetricsReporter);
+ when(mUiDelegate.getSuggestionsSource()).thenReturn(mSuggestionSource);
+ when(mUiDelegate.getMetricsReporter()).thenReturn(mMetricsReporter);
}
@Test
@@ -81,7 +81,7 @@ public void testGetSuggestionRank() {
List<SnippetArticle> bookmarks =
registerCategory(mSuggestionSource, KnownCategories.BOOKMARKS, 4);
- SectionList sectionList = new SectionList(mNtpManager, mOfflinePageBridge);
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge);
assertThat(articles.get(0).getGlobalRank(), equalTo(0));
assertThat(articles.get(0).getSectionRank(), equalTo(0));
@@ -146,7 +146,7 @@ public void testGetActionItemRank() {
registerCategory(mSuggestionSource,
new CategoryInfoBuilder(KnownCategories.DOWNLOADS).withViewAllAction().build(), 3);
- SectionList sectionList = new SectionList(mNtpManager, mOfflinePageBridge);
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge);
SuggestionRanker ranker = sectionList.getSuggestionRankerForTesting();
assertThat(ranker.getActionItemRank(KnownCategories.ARTICLES), equalTo(0));
@@ -158,7 +158,7 @@ public void testGetActionItemRank() {
public void testGetActionItemRankWhenInvisible() {
registerCategory(mSuggestionSource, KnownCategories.ARTICLES, 3);
- SectionList sectionList = new SectionList(mNtpManager, mOfflinePageBridge);
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge);
sectionList.getSuggestionRankerForTesting().getActionItemRank(KnownCategories.ARTICLES);
}

Powered by Google App Engine
This is Rietveld 408576698