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

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

Issue 2623993007: 🏠 Extract the ContentSuggestionManager interface from NTP (Closed)
Patch Set: aaaand rebase again 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
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java
index 5d965e19da582aa03c92a1cf15dacb3417a78a9d..7e750c244b9169b7f7a168d9f0292f611910c9be 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java
@@ -33,14 +33,15 @@
import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.EnableFeatures;
-import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
import org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.CategoryInfoBuilder;
import org.chromium.chrome.browser.ntp.snippets.CategoryStatus;
import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
import org.chromium.chrome.browser.ntp.snippets.SuggestionsSource;
import org.chromium.chrome.browser.offlinepages.OfflinePageItem;
import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter;
+import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
import org.chromium.chrome.browser.suggestions.SuggestionsRanker;
+import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
import org.chromium.testing.local.LocalRobolectricTestRunner;
import java.util.Arrays;
@@ -57,7 +58,8 @@
private SuggestionsSection.Delegate mDelegate;
@Mock
private NodeParent mParent;
- @Mock private NewTabPageManager mManager;
+ @Mock
+ private SuggestionsUiDelegate mUiDelegate;
private FakeOfflinePageBridge mBridge;
@Before
@@ -465,7 +467,7 @@ private SuggestionsSection createSectionWithReloadAction(boolean hasReloadAction
private SuggestionsSection createSection(SuggestionsCategoryInfo info) {
SuggestionsSection section = new SuggestionsSection(
- mDelegate, mManager, mock(SuggestionsRanker.class), mBridge, info);
+ mDelegate, mUiDelegate, mock(SuggestionsRanker.class), mBridge, info);
section.setParent(mParent);
return section;
}
@@ -476,10 +478,11 @@ private OfflinePageItem createOfflinePageItem(String url, long offlineId) {
private static void verifyAction(SuggestionsSection section, @ActionItem.Action int action) {
SuggestionsSource suggestionsSource = mock(SuggestionsSource.class);
- NewTabPageManager manager = mock(NewTabPageManager.class);
+ SuggestionsUiDelegate manager = mock(SuggestionsUiDelegate.class);
+ SuggestionsNavigationDelegate navDelegate = mock(SuggestionsNavigationDelegate.class);
when(manager.getSuggestionsSource()).thenReturn(suggestionsSource);
- when(manager.getSuggestionsMetricsReporter())
- .thenReturn(mock(SuggestionsMetricsReporter.class));
+ when(manager.getNavigationDelegate()).thenReturn(navDelegate);
+ when(manager.getMetricsReporter()).thenReturn(mock(SuggestionsMetricsReporter.class));
if (action != ActionItem.ACTION_NONE) {
section.getActionItem().performAction(manager);
@@ -487,7 +490,7 @@ private static void verifyAction(SuggestionsSection section, @ActionItem.Action
verify(section.getCategoryInfo(),
(action == ActionItem.ACTION_VIEW_ALL ? times(1) : never()))
- .performViewAllAction(manager);
+ .performViewAllAction(navDelegate);
verify(suggestionsSource,
action == ActionItem.ACTION_RELOAD || action == ActionItem.ACTION_FETCH_MORE
? times(1)
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SectionListTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698