| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| package org.chromium.chrome.browser.suggestions; |
| |
| import static org.chromium.chrome.test.BottomSheetTestRule.waitForWindowUpdates; |
| |
| import android.support.test.filters.MediumTest; |
| |
| import org.junit.Before; |
| import org.junit.Rule; |
| import org.junit.Test; |
| import org.junit.runner.RunWith; |
| |
| import org.chromium.base.test.util.DisabledTest; |
| import org.chromium.base.test.util.Feature; |
| import org.chromium.base.test.util.Restriction; |
| import org.chromium.chrome.browser.ntp.NtpUiCaptureTestData; |
| import org.chromium.chrome.browser.preferences.ChromePreferenceManager; |
| import org.chromium.chrome.browser.test.ScreenShooter; |
| import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; |
| import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
| import org.chromium.chrome.test.util.browser.suggestions.SuggestionsDependenciesRule; |
| import org.chromium.chrome.test.util.browser.suggestions.mostvisited.FakeMostVisitedSites; |
| import org.chromium.ui.test.util.UiRestriction; |
| |
| /** |
| * Tests for the appearance of the home sheet when there are no tiles. |
| */ |
| @DisabledTest(message = "https://crbug.com/805160") |
| @RunWith(ChromeJUnit4ClassRunner.class) |
| @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) // ChromeHome is only enabled on phones |
| public class HomeSheetNoTilesUiCaptureTest { |
| @Rule |
| public SuggestionsBottomSheetTestRule mActivityRule = new SuggestionsBottomSheetTestRule(); |
| |
| @Rule |
| public SuggestionsDependenciesRule setupSuggestions() { |
| SuggestionsDependenciesRule.TestFactory depsFactory = NtpUiCaptureTestData.createFactory(); |
| ((FakeMostVisitedSites) depsFactory.mostVisitedSites).setTileSuggestions(new String[] {}); |
| return new SuggestionsDependenciesRule(depsFactory); |
| } |
| |
| @Rule |
| public ScreenShooter mScreenShooter = new ScreenShooter(); |
| |
| @Before |
| public void setup() throws InterruptedException { |
| ChromePreferenceManager.getInstance().writeBoolean( |
| ChromePreferenceManager.NTP_SIGNIN_PROMO_DISMISSED, true); |
| mActivityRule.startMainActivityOnBlankPage(); |
| } |
| |
| @Test |
| @MediumTest |
| @Feature({"UiCatalogue"}) |
| public void testNoTiles() { |
| mActivityRule.setSheetState(BottomSheet.SheetState.FULL, false); |
| waitForWindowUpdates(); |
| mScreenShooter.shoot("NoTiles"); |
| } |
| } |