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

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

Issue 2665983005: Ntp: use callbacks for partial binding, they can carry more detail. (Closed)
Patch Set: Address review comments from bauerb. 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/InnerNodeTest.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 96db4e3def151329ac7680cc9270d52d8760fad1..30cba140162db61d963fb1bf5c64cad1eab591b1 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
@@ -15,6 +15,8 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.same;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
@@ -40,11 +42,11 @@ import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.DisableHistogramsRule;
import org.chromium.chrome.browser.EnableFeatures;
import org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.CategoryInfoBuilder;
+import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder.UpdateLayoutParamsCallback;
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.PartialUpdateId;
import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter;
import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
import org.chromium.chrome.browser.suggestions.SuggestionsRanker;
@@ -595,7 +597,8 @@ public class SuggestionsSectionTest {
// Remove the first card. The second one should get the update.
section.removeSuggestionById(suggestions.get(0).mIdWithinCategory);
- verify(mParent).onItemRangeChanged(section, 1, 1, PartialUpdateId.CARD_BACKGROUND);
+ verify(mParent).onItemRangeChanged(
+ same(section), eq(1), eq(1), any(UpdateLayoutParamsCallback.class));
}
@Test
@@ -608,7 +611,8 @@ public class SuggestionsSectionTest {
// Remove the last card. The penultimate one should get the update.
section.removeSuggestionById(suggestions.get(4).mIdWithinCategory);
- verify(mParent).onItemRangeChanged(section, 4, 1, PartialUpdateId.CARD_BACKGROUND);
+ verify(mParent).onItemRangeChanged(
+ same(section), eq(4), eq(1), any(UpdateLayoutParamsCallback.class));
}
@Test
@@ -621,7 +625,8 @@ public class SuggestionsSectionTest {
// Remove the last card. The penultimate one should get the update.
section.removeSuggestionById(suggestions.get(1).mIdWithinCategory);
- verify(mParent).onItemRangeChanged(section, 1, 1, PartialUpdateId.CARD_BACKGROUND);
+ verify(mParent).onItemRangeChanged(
+ same(section), eq(1), eq(1), any(UpdateLayoutParamsCallback.class));
}
@Test
@@ -662,7 +667,8 @@ public class SuggestionsSectionTest {
section.setSuggestions(createDummySuggestions(2, /* categoryId = */ 42, "new"),
CategoryStatus.AVAILABLE, /* replaceExisting = */ false);
- verify(mParent).onItemRangeChanged(section, 5, 1, PartialUpdateId.CARD_BACKGROUND);
+ verify(mParent).onItemRangeChanged(
+ same(section), eq(5), eq(1), any(UpdateLayoutParamsCallback.class));
}
private SuggestionsSection createSectionWithSuggestions(List<SnippetArticle> snippets) {
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/InnerNodeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698