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

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

Issue 2639933003: [NTP suggestions UI] Track precise count of suggestions seen. (Closed)
Patch Set: Fix rebase #2 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/NewTabPageAdapterTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java
index b3414961d2c01e0a2ed0128b93f3ac8df6fc9d24..1efc4a65411b0fef5b9bdb1528d37f2d97d12599 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/NewTabPageAdapterTest.java
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.chromium.base.test.util.Matchers.greaterThanOrEqualTo;
+import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.bindViewHolders;
import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.createDummySuggestions;
import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.registerCategory;
import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsTestUtils.viewTypeToString;
@@ -420,9 +421,9 @@ public class NewTabPageAdapterTest {
reloadNtp();
assertItemsFor(section(4), section(2));
- mAdapter.getSectionListForTesting()
- .getSectionForTesting(KnownCategories.BOOKMARKS)
- .childSeen(2);
+ // Bind the whole section - indicate that it is being viewed.
+ bindViewHolders(mAdapter.getSectionListForTesting().getSectionForTesting(
+ KnownCategories.BOOKMARKS));
List<SnippetArticle> newSnippets = createDummySuggestions(3, KnownCategories.ARTICLES);
mSource.setSuggestionsForCategory(KnownCategories.ARTICLES, newSnippets);
@@ -432,40 +433,6 @@ public class NewTabPageAdapterTest {
assertItemsFor(section(3), section(2));
}
- /**
- * Tests that the UI updates the first item of the section if the first item of some other
- * section has been viewed.
- */
- @Test
- @Feature({"Ntp"})
- public void testUIUpdatesOnNewSuggestionsWhenFirstOfOtherSectionIsSeen() {
- List<SnippetArticle> snippets = createDummySuggestions(4, KnownCategories.ARTICLES);
- mSource.setStatusForCategory(KnownCategories.ARTICLES, CategoryStatus.AVAILABLE);
- mSource.setSuggestionsForCategory(KnownCategories.ARTICLES, snippets);
-
- List<SnippetArticle> bookmarks = createDummySuggestions(1, KnownCategories.BOOKMARKS);
- mSource.setStatusForCategory(KnownCategories.BOOKMARKS, CategoryStatus.AVAILABLE);
- mSource.setInfoForCategory(KnownCategories.BOOKMARKS,
- new CategoryInfoBuilder(KnownCategories.BOOKMARKS).showIfEmpty().build());
- mSource.setSuggestionsForCategory(KnownCategories.BOOKMARKS, bookmarks);
-
- reloadNtp();
- assertItemsFor(section(4), section(1));
-
- mAdapter.getSectionListForTesting()
- .getSectionForTesting(KnownCategories.BOOKMARKS)
- .childSeen(1);
-
- List<SnippetArticle> newSnippets = createDummySuggestions(3, KnownCategories.ARTICLES);
- SnippetArticle newer = newSnippets.get(0);
-
- mSource.setSuggestionsForCategory(KnownCategories.ARTICLES, newSnippets);
- assertItemsFor(section(3).withFirstItem(newer), section(1));
-
- reloadNtp();
- assertItemsFor(section(3).withFirstItem(newer), section(1));
- }
-
/** Tests whether a section stays visible if empty, if required. */
@Test
@Feature({"Ntp"})

Powered by Google App Engine
This is Rietveld 408576698