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 750ed15f45739037c0d68c739a7ed5691010b8b9..f9e2a34bbfc35df15b4d1c04660dcc8fc57ec5ba 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 |
@@ -14,7 +14,6 @@ |
import static org.mockito.Mockito.when; |
import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsUnitTestUtils.bindViewHolders; |
-import static org.chromium.chrome.browser.ntp.cards.ContentSuggestionsUnitTestUtils.makeUiConfig; |
import static org.chromium.chrome.test.util.browser.suggestions.ContentSuggestionsTestUtils.createDummySuggestions; |
import static org.chromium.chrome.test.util.browser.suggestions.ContentSuggestionsTestUtils.registerCategory; |
@@ -37,9 +36,6 @@ |
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; |
import org.chromium.chrome.browser.suggestions.SuggestionsMetricsReporter; |
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; |
-import org.chromium.chrome.browser.widget.displaystyle.HorizontalDisplayStyle; |
-import org.chromium.chrome.browser.widget.displaystyle.UiConfig; |
-import org.chromium.chrome.browser.widget.displaystyle.VerticalDisplayStyle; |
import org.chromium.chrome.test.util.browser.suggestions.ContentSuggestionsTestUtils.CategoryInfoBuilder; |
import org.chromium.chrome.test.util.browser.suggestions.FakeSuggestionsSource; |
import org.chromium.testing.local.LocalRobolectricTestRunner; |
@@ -99,7 +95,7 @@ public void testGetSuggestionRank() { |
registerCategory(mSuggestionSource, CATEGORY1 + CATEGORY2, 0); |
List<SnippetArticle> suggestions2 = registerCategory(mSuggestionSource, CATEGORY2, 4); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, makeUiConfig()); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
bindViewHolders(sectionList); |
@@ -133,7 +129,7 @@ public void testGetSuggestionRankWithChanges() { |
registerCategory(mSuggestionSource, CATEGORY1 + CATEGORY2, 0); |
List<SnippetArticle> suggestions2 = registerCategory(mSuggestionSource, CATEGORY2, 4); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, makeUiConfig()); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
bindViewHolders(sectionList, 0, 5); // Bind until after the third item from |suggestions1|. |
@@ -228,7 +224,7 @@ public void testGetActionItemRank() { |
registerCategory(mSuggestionSource, |
new CategoryInfoBuilder(CATEGORY2).withViewAllAction().build(), 3); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, makeUiConfig()); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
bindViewHolders(sectionList); |
assertThat(sectionList.getSectionForTesting(CATEGORY1) |
@@ -247,7 +243,7 @@ public void testRemovesSectionsWhenUiDelegateDestroyed() { |
registerCategory(mSuggestionSource, CATEGORY1, 1); |
registerCategory(mSuggestionSource, |
new CategoryInfoBuilder(CATEGORY2).withViewAllAction().build(), 3); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, makeUiConfig()); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
bindViewHolders(sectionList); |
ArgumentCaptor<DestructionObserver> argument = |
@@ -269,34 +265,22 @@ public void testRemovesSectionsWhenUiDelegateDestroyed() { |
@Test |
@Feature({"Ntp"}) |
- public void testArticlesHeaderShownOnRegularDisplays() { |
+ public void testArticlesHeaderHiddenWhenAlone() { |
registerCategory(mSuggestionSource, KnownCategories.ARTICLES, 1); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, makeUiConfig()); |
- SuggestionsSection articles = sectionList.getSectionForTesting(KnownCategories.ARTICLES); |
- assertTrue(articles.getHeaderItemForTesting().isVisible()); |
- } |
- |
- @Test |
- @Feature({"Ntp"}) |
- public void testArticlesHeaderHiddenOnNarrowDisplays() { |
- registerCategory(mSuggestionSource, KnownCategories.ARTICLES, 1); |
- |
- UiConfig config = makeUiConfig(HorizontalDisplayStyle.NARROW, VerticalDisplayStyle.REGULAR); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, config); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
SuggestionsSection articles = sectionList.getSectionForTesting(KnownCategories.ARTICLES); |
assertFalse(articles.getHeaderItemForTesting().isVisible()); |
} |
@Test |
@Feature({"Ntp"}) |
- public void testArticlesHeaderHiddenOnFlatDisplays() { |
- registerCategory(mSuggestionSource, KnownCategories.ARTICLES, 1); |
+ public void testRandomSectionHeaderShownWhenAlone() { |
+ registerCategory(mSuggestionSource, CATEGORY1, 1); |
- UiConfig config = makeUiConfig(HorizontalDisplayStyle.REGULAR, VerticalDisplayStyle.FLAT); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, config); |
- SuggestionsSection articles = sectionList.getSectionForTesting(KnownCategories.ARTICLES); |
- assertFalse(articles.getHeaderItemForTesting().isVisible()); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
+ SuggestionsSection section = sectionList.getSectionForTesting(CATEGORY1); |
+ assertTrue(section.getHeaderItemForTesting().isVisible()); |
} |
@Test |
@@ -305,8 +289,7 @@ public void testArticlesHeaderShownWithOtherSections() { |
registerCategory(mSuggestionSource, KnownCategories.ARTICLES, 1); |
registerCategory(mSuggestionSource, CATEGORY1, 1); |
- UiConfig config = makeUiConfig(HorizontalDisplayStyle.REGULAR, VerticalDisplayStyle.FLAT); |
- SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge, config); |
+ SectionList sectionList = new SectionList(mUiDelegate, mOfflinePageBridge); |
SuggestionsSection articles = sectionList.getSectionForTesting(KnownCategories.ARTICLES); |
assertTrue(articles.getHeaderItemForTesting().isVisible()); |
} |