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

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

Issue 2024933002: [NTP Snippets] Show a status card when there are no available snippets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased and address comments Created 4 years, 6 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/java_sources.gni ('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/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 201de2084421b3482c1c5e92cdafc0c6777904e8..a2dcb47dc935829e0c9ca26a1ff36e0f86ac352f 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
@@ -60,8 +60,12 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
@Feature({"Ntp"})
public void testSnippetLoading() {
NewTabPageAdapter ntpa = new NewTabPageAdapter(mNewTabPageManager, null);
- assertEquals(1, ntpa.getItemCount());
+
+ assertEquals(4, ntpa.getItemCount());
assertEquals(NewTabPageListItem.VIEW_TYPE_ABOVE_THE_FOLD, ntpa.getItemViewType(0));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_HEADER, ntpa.getItemViewType(1));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_STATUS, ntpa.getItemViewType(2));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(3));
List<SnippetArticle> snippets = createDummySnippets();
mSnippetsObserver.onSnippetsReceived(snippets);
@@ -88,11 +92,13 @@ public void testSnippetLoading() {
public void testSnippetLoadingInitiallyEmpty() {
NewTabPageAdapter ntpa = new NewTabPageAdapter(mNewTabPageManager, null);
- // If we don't get anything, we should still have the above-the-fold item and the spacing
- // present.
+ // If we don't get anything, we should be in the same situation as the initial one.
mSnippetsObserver.onSnippetsReceived(new ArrayList<SnippetArticle>());
- assertEquals(1, ntpa.getItemCount());
+ assertEquals(4, ntpa.getItemCount());
assertEquals(NewTabPageListItem.VIEW_TYPE_ABOVE_THE_FOLD, ntpa.getItemViewType(0));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_HEADER, ntpa.getItemViewType(1));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_STATUS, ntpa.getItemViewType(2));
+ assertEquals(NewTabPageListItem.VIEW_TYPE_SPACING, ntpa.getItemViewType(3));
// We should load new snippets when we get notified about them.
List<SnippetArticle> snippets = createDummySnippets();
@@ -117,16 +123,14 @@ public void testSnippetLoadingInitiallyEmpty() {
@Feature({"Ntp"})
public void testSnippetClearing() {
NewTabPageAdapter ntpa = new NewTabPageAdapter(mNewTabPageManager, null);
- assertEquals(1, ntpa.getItemCount());
- assertEquals(NewTabPageListItem.VIEW_TYPE_ABOVE_THE_FOLD, ntpa.getItemViewType(0));
List<SnippetArticle> snippets = createDummySnippets();
mSnippetsObserver.onSnippetsReceived(snippets);
assertEquals(3 + snippets.size(), ntpa.getItemCount());
- // When we clear the snippets, we should only have the header and above-the-fold left.
+ // When we clear the snippets, we should go back to the situation with the status card.
mSnippetsObserver.onSnippetsDisabled();
- assertEquals(3, ntpa.getItemCount());
+ assertEquals(4, ntpa.getItemCount());
// The adapter should now be waiting for new snippets.
mSnippetsObserver.onSnippetsReceived(snippets);
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698