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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java

Issue 2853573002: Convert ChromeTabbedActivityTestCaseBase children to JUnit4 (Closed)
Patch Set: rebase Created 3 years, 7 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/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java
index a81b3f30b9d3edbd0029f84b0ca5aad2136516df..d467487b2de644f283ef2f1e765aa594b0af661b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ntp/NewTabPageTest.java
@@ -5,14 +5,21 @@
package org.chromium.chrome.browser.ntp;
import android.graphics.Canvas;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
import android.support.test.filters.MediumTest;
import android.support.test.filters.SmallTest;
-import android.test.UiThreadTest;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.CommandLineFlags;
@@ -21,6 +28,7 @@ import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView;
import org.chromium.chrome.browser.omnibox.LocationBarLayout;
@@ -30,7 +38,9 @@ import org.chromium.chrome.browser.suggestions.TileGroupDelegateImpl;
import org.chromium.chrome.browser.suggestions.TileSource;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
-import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
+import org.chromium.chrome.test.ChromeActivityTestRule;
+import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
+import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.util.ChromeTabUtils;
import org.chromium.chrome.test.util.NewTabPageTestUtils;
import org.chromium.chrome.test.util.OmniboxTestUtils;
@@ -39,6 +49,7 @@ import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.content.browser.test.util.KeyUtils;
import org.chromium.content.browser.test.util.TestTouchUtils;
+import org.chromium.content.browser.test.util.TouchCommon;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.net.test.EmbeddedTestServer;
import org.chromium.net.test.util.TestWebServer;
@@ -53,8 +64,15 @@ import java.util.concurrent.TimeUnit;
/**
* Tests for the native android New Tab Page.
*/
+@RunWith(ChromeJUnit4ClassRunner.class)
+@CommandLineFlags.Add({
+ ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
+ ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG,
+})
@RetryOnFailure
-public class NewTabPageTest extends ChromeTabbedActivityTestBase {
+public class NewTabPageTest {
+ @Rule
+ public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
private static final String TEST_PAGE = "/chrome/test/data/android/navigate/simple.html";
@@ -70,42 +88,38 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
private FakeMostVisitedSites mMostVisitedSites;
private EmbeddedTestServer mTestServer;
- @Override
- protected void setUp() throws Exception {
- mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext());
+ @Before
+ public void setUp() throws Exception {
+ mTestServer = EmbeddedTestServer.createAndStartServer(
+ InstrumentationRegistry.getInstrumentation().getContext());
mSiteSuggestionUrls = new String[] {mTestServer.getURL(TEST_PAGE)};
mMostVisitedSites = new FakeMostVisitedSites();
mMostVisitedSites.setTileSuggestions(FAKE_MOST_VISITED_TITLES, mSiteSuggestionUrls,
FAKE_MOST_VISITED_WHITELIST_ICON_PATHS, FAKE_MOST_VISITED_SOURCES);
TileGroupDelegateImpl.setMostVisitedSitesForTests(mMostVisitedSites);
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- mTestServer.stopAndDestroyServer();
- TileGroupDelegateImpl.setMostVisitedSitesForTests(null);
- super.tearDown();
- }
-
- @Override
- public void startMainActivity() throws InterruptedException {
- startMainActivityWithURL(UrlConstants.NTP_URL);
- mTab = getActivity().getActivityTab();
+ mActivityTestRule.startMainActivityWithURL(UrlConstants.NTP_URL);
+ mTab = mActivityTestRule.getActivity().getActivityTab();
NewTabPageTestUtils.waitForNtpLoaded(mTab);
- assertTrue(mTab.getNativePage() instanceof NewTabPage);
+ Assert.assertTrue(mTab.getNativePage() instanceof NewTabPage);
mNtp = (NewTabPage) mTab.getNativePage();
mFakebox = mNtp.getView().findViewById(R.id.search_box);
mTileGridLayout = (ViewGroup) mNtp.getView().findViewById(R.id.tile_grid_layout);
- assertEquals(mSiteSuggestionUrls.length, mTileGridLayout.getChildCount());
+ Assert.assertEquals(mSiteSuggestionUrls.length, mTileGridLayout.getChildCount());
}
+ @After
+ public void tearDown() throws Exception {
+ mTestServer.stopAndDestroyServer();
+ TileGroupDelegateImpl.setMostVisitedSitesForTests(null);
+ }
+
+ @Test
@MediumTest
@Feature({"NewTabPage", "RenderTest"})
public void testRender() throws IOException {
- ViewRenderer viewRenderer = new ViewRenderer(getActivity(),
+ ViewRenderer viewRenderer = new ViewRenderer(mActivityTestRule.getActivity(),
"chrome/test/data/android/render_tests", "NewTabPageTest");
viewRenderer.renderAndCompare(mTileGridLayout, "most_visited");
viewRenderer.renderAndCompare(mFakebox, "fakebox");
@@ -131,56 +145,62 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
viewRenderer.renderAndCompare(mNtp.getView().getRootView(), "new_tab_page_scrolled");
}
+ @Test
@MediumTest
@Feature({"NewTabPage"})
- @UiThreadTest
- public void testThumbnailInvalidations() {
- captureThumbnail();
- assertFalse(mNtp.shouldCaptureThumbnail());
+ public void testThumbnailInvalidations() throws Throwable {
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ captureThumbnail();
+ Assert.assertFalse(mNtp.shouldCaptureThumbnail());
- // Check that we invalidate the thumbnail when the Recycler View is updated.
- NewTabPageRecyclerView recyclerView = mNtp.getNewTabPageView().getRecyclerView();
+ // Check that we invalidate the thumbnail when the Recycler View is updated.
+ NewTabPageRecyclerView recyclerView = mNtp.getNewTabPageView().getRecyclerView();
- recyclerView.getAdapter().notifyDataSetChanged();
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyDataSetChanged();
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemChanged(0);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemChanged(0);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemInserted(0);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemInserted(0);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemMoved(0, 1);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemMoved(0, 1);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemRangeChanged(0, 1);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemRangeChanged(0, 1);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemRangeInserted(0, 1);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemRangeInserted(0, 1);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemRangeRemoved(0, 1);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemRangeRemoved(0, 1);
+ assertThumbnailInvalidAndRecapture();
- recyclerView.getAdapter().notifyItemRemoved(0);
- assertThumbnailInvalidAndRecapture();
+ recyclerView.getAdapter().notifyItemRemoved(0);
+ assertThumbnailInvalidAndRecapture();
+ }
+ });
}
/**
* Tests that clicking on the fakebox causes it to animate upwards and focus the omnibox, and
* defocusing the omnibox causes the fakebox to animate back down.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
- public void testFocusFakebox() throws InterruptedException {
+ public void testFocusFakebox() {
int initialFakeboxTop = getFakeboxTop(mNtp);
- singleClickView(mFakebox);
+ TouchCommon.singleClickView(mFakebox);
waitForFakeboxFocusAnimationComplete(mNtp);
- UrlBar urlBar = (UrlBar) getActivity().findViewById(R.id.url_bar);
+ UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
OmniboxTestUtils.waitForFocusAndKeyboardActive(urlBar, true);
int afterFocusFakeboxTop = getFakeboxTop(mNtp);
- assertTrue(afterFocusFakeboxTop < initialFakeboxTop);
+ Assert.assertTrue(afterFocusFakeboxTop < initialFakeboxTop);
OmniboxTestUtils.toggleUrlBarFocus(urlBar, false);
waitForFakeboxTopPosition(mNtp, initialFakeboxTop);
@@ -191,24 +211,26 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
* Tests that clicking on the fakebox causes it to focus the omnibox and allows typing and
* navigating to a URL.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
@DisableIf.Build(sdk_is_greater_than = 22, message = "crbug.com/593007")
public void testSearchFromFakebox() throws InterruptedException {
- singleClickView(mFakebox);
+ TouchCommon.singleClickView(mFakebox);
waitForFakeboxFocusAnimationComplete(mNtp);
- final UrlBar urlBar = (UrlBar) getActivity().findViewById(R.id.url_bar);
+ final UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
OmniboxTestUtils.waitForFocusAndKeyboardActive(urlBar, true);
- getInstrumentation().sendStringSync(TEST_PAGE);
+ InstrumentationRegistry.getInstrumentation().sendStringSync(TEST_PAGE);
LocationBarLayout locationBar =
- (LocationBarLayout) getActivity().findViewById(R.id.location_bar);
+ (LocationBarLayout) mActivityTestRule.getActivity().findViewById(R.id.location_bar);
OmniboxTestUtils.waitForOmniboxSuggestions(locationBar);
ChromeTabUtils.waitForTabPageLoaded(mTab, new Runnable() {
@Override
public void run() {
- KeyUtils.singleKeyEventView(getInstrumentation(), urlBar, KeyEvent.KEYCODE_ENTER);
+ KeyUtils.singleKeyEventView(InstrumentationRegistry.getInstrumentation(), urlBar,
+ KeyEvent.KEYCODE_ENTER);
}
});
}
@@ -216,6 +238,7 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
/**
* Tests clicking on a most visited item.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
public void testClickMostVisitedItem() throws InterruptedException {
@@ -223,36 +246,39 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
@Override
public void run() {
View mostVisitedItem = mTileGridLayout.getChildAt(0);
- singleClickView(mostVisitedItem);
+ TouchCommon.singleClickView(mostVisitedItem);
}
});
- assertEquals(mSiteSuggestionUrls[0], mTab.getUrl());
+ Assert.assertEquals(mSiteSuggestionUrls[0], mTab.getUrl());
}
/**
* Tests opening a most visited item in a new tab.
*/
+ @Test
@DisabledTest // Flaked on the try bot. http://crbug.com/543138
@SmallTest
@Feature({"NewTabPage"})
public void testOpenMostVisitedItemInNewTab() throws InterruptedException {
- invokeContextMenuAndOpenInANewTab(mTileGridLayout.getChildAt(0),
+ mActivityTestRule.invokeContextMenuAndOpenInANewTab(mTileGridLayout.getChildAt(0),
ContextMenuManager.ID_OPEN_IN_NEW_TAB, false, mSiteSuggestionUrls[0]);
}
/**
* Tests opening a most visited item in a new incognito tab.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
public void testOpenMostVisitedItemInIncognitoTab() throws InterruptedException {
- invokeContextMenuAndOpenInANewTab(mTileGridLayout.getChildAt(0),
+ mActivityTestRule.invokeContextMenuAndOpenInANewTab(mTileGridLayout.getChildAt(0),
ContextMenuManager.ID_OPEN_IN_INCOGNITO_TAB, true, mSiteSuggestionUrls[0]);
}
/**
* Tests deleting a most visited item.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
public void testRemoveMostVisitedItem() {
@@ -260,19 +286,20 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
ArrayList<View> views = new ArrayList<>();
mTileGridLayout.findViewsWithText(
views, FAKE_MOST_VISITED_TITLES[0], View.FIND_VIEWS_WITH_TEXT);
- assertEquals(1, views.size());
+ Assert.assertEquals(1, views.size());
- TestTouchUtils.longClickView(getInstrumentation(), mostVisitedItem);
- assertTrue(getInstrumentation().invokeContextMenuAction(
- getActivity(), ContextMenuManager.ID_REMOVE, 0));
+ TestTouchUtils.longClickView(InstrumentationRegistry.getInstrumentation(), mostVisitedItem);
+ Assert.assertTrue(InstrumentationRegistry.getInstrumentation().invokeContextMenuAction(
+ mActivityTestRule.getActivity(), ContextMenuManager.ID_REMOVE, 0));
- assertTrue(mMostVisitedSites.isUrlBlacklisted(mSiteSuggestionUrls[0]));
+ Assert.assertTrue(mMostVisitedSites.isUrlBlacklisted(mSiteSuggestionUrls[0]));
}
+ @Test
@MediumTest
@Feature({"NewTabPage"})
public void testUrlFocusAnimationsDisabledOnLoad() throws InterruptedException {
- assertFalse(getUrlFocusAnimationsDisabled());
+ Assert.assertFalse(getUrlFocusAnimationsDisabled());
ChromeTabUtils.waitForTabPageLoaded(mTab, new Runnable() {
@Override
public void run() {
@@ -284,15 +311,16 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
mTab.loadUrl(new LoadUrlParams(mTestServer.getURL(TEST_PAGE),
pageTransition));
// It should be disabled as soon as a load URL is triggered.
- assertTrue(getUrlFocusAnimationsDisabled());
+ Assert.assertTrue(getUrlFocusAnimationsDisabled());
}
});
}
});
// Ensure it is still marked as disabled once the new page is fully loaded.
- assertTrue(getUrlFocusAnimationsDisabled());
+ Assert.assertTrue(getUrlFocusAnimationsDisabled());
}
+ @Test
@LargeTest
@Feature({"NewTabPage"})
public void testUrlFocusAnimationsEnabledOnFailedLoad() throws Exception {
@@ -304,7 +332,7 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
@Override
public void run() {
try {
- assertTrue(delaySemaphore.tryAcquire(10, TimeUnit.SECONDS));
+ Assert.assertTrue(delaySemaphore.tryAcquire(10, TimeUnit.SECONDS));
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -314,14 +342,15 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
"/ntp_test.html",
"<html><body></body></html>", null, delayAction);
- assertFalse(getUrlFocusAnimationsDisabled());
+ Assert.assertFalse(getUrlFocusAnimationsDisabled());
clickFakebox();
- UrlBar urlBar = (UrlBar) getActivity().findViewById(R.id.url_bar);
+ UrlBar urlBar = (UrlBar) mActivityTestRule.getActivity().findViewById(R.id.url_bar);
OmniboxTestUtils.waitForFocusAndKeyboardActive(urlBar, true);
- typeInOmnibox(testPageUrl, false);
+ mActivityTestRule.typeInOmnibox(testPageUrl, false);
LocationBarLayout locationBar =
- (LocationBarLayout) getActivity().findViewById(R.id.location_bar);
+ (LocationBarLayout) mActivityTestRule.getActivity().findViewById(
+ R.id.location_bar);
OmniboxTestUtils.waitForOmniboxSuggestions(locationBar);
final CallbackHelper loadedCallback = new CallbackHelper();
@@ -334,7 +363,8 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
});
final View v = urlBar;
- KeyUtils.singleKeyEventView(getInstrumentation(), v, KeyEvent.KEYCODE_ENTER);
+ KeyUtils.singleKeyEventView(
+ InstrumentationRegistry.getInstrumentation(), v, KeyEvent.KEYCODE_ENTER);
waitForUrlFocusAnimationsDisabledState(true);
waitForTabLoading();
@@ -348,7 +378,7 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
waitForUrlFocusAnimationsDisabledState(false);
delaySemaphore.release();
loadedCallback.waitForCallback(0);
- assertFalse(getUrlFocusAnimationsDisabled());
+ Assert.assertFalse(getUrlFocusAnimationsDisabled());
} finally {
webServer.shutdown();
}
@@ -357,40 +387,51 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
/**
* Tests setting whether the search provider has a logo.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
- @UiThreadTest
- public void testSetSearchProviderHasLogo() {
- NewTabPageView ntpView = mNtp.getNewTabPageView();
- View logoView = ntpView.findViewById(R.id.search_provider_logo);
- assertEquals(View.VISIBLE, logoView.getVisibility());
- ntpView.setSearchProviderHasLogo(false);
- assertEquals(View.GONE, logoView.getVisibility());
- ntpView.setSearchProviderHasLogo(true);
- assertEquals(View.VISIBLE, logoView.getVisibility());
+ public void testSetSearchProviderHasLogo() throws Throwable {
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ NewTabPageView ntpView = mNtp.getNewTabPageView();
+ View logoView = ntpView.findViewById(R.id.search_provider_logo);
+ Assert.assertEquals(View.VISIBLE, logoView.getVisibility());
+ ntpView.setSearchProviderHasLogo(false);
+ Assert.assertEquals(View.GONE, logoView.getVisibility());
+ ntpView.setSearchProviderHasLogo(true);
+ Assert.assertEquals(View.VISIBLE, logoView.getVisibility());
+ }
+ });
}
/**
* Tests setting whether the search provider has a logo when the condensed UI is enabled.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
@CommandLineFlags.Add("enable-features=NTPCondensedLayout")
- @UiThreadTest
- public void testSetSearchProviderHasLogoCondensedUi() {
- NewTabPageView ntpView = mNtp.getNewTabPageView();
- View logoView = ntpView.findViewById(R.id.search_provider_logo);
- assertEquals(View.GONE, logoView.getVisibility());
- ntpView.setSearchProviderHasLogo(false);
- assertEquals(View.GONE, logoView.getVisibility());
- ntpView.setSearchProviderHasLogo(true);
- assertEquals(View.GONE, logoView.getVisibility());
+ public void testSetSearchProviderHasLogoCondensedUi() throws Throwable {
+ mActivityTestRule.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ NewTabPageView ntpView = mNtp.getNewTabPageView();
+ View logoView = ntpView.findViewById(R.id.search_provider_logo);
+ Assert.assertEquals(View.GONE, logoView.getVisibility());
+ ntpView.setSearchProviderHasLogo(false);
+ Assert.assertEquals(View.GONE, logoView.getVisibility());
+ ntpView.setSearchProviderHasLogo(true);
+ Assert.assertEquals(View.GONE, logoView.getVisibility());
+ }
+ });
}
/**
* Verifies that the placeholder is only shown when there are no tile suggestions and the search
* provider has no logo.
*/
+ @Test
@SmallTest
@Feature({"NewTabPage"})
public void testPlaceholder() {
@@ -400,10 +441,10 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
// Initially, the logo is visible, the search box is visible, there is one tile suggestion,
// and the placeholder has not been inflated yet.
- assertEquals(View.VISIBLE, logoView.getVisibility());
- assertEquals(View.VISIBLE, searchBoxView.getVisibility());
- assertEquals(1, mTileGridLayout.getChildCount());
- assertNull(ntpView.getPlaceholder());
+ Assert.assertEquals(View.VISIBLE, logoView.getVisibility());
+ Assert.assertEquals(View.VISIBLE, searchBoxView.getVisibility());
+ Assert.assertEquals(1, mTileGridLayout.getChildCount());
+ Assert.assertNull(ntpView.getPlaceholder());
// When the search provider has no logo and there are no tile suggestions, the placeholder
// is shown.
@@ -411,8 +452,8 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
@Override
public void run() {
ntpView.setSearchProviderHasLogo(false);
- assertEquals(View.GONE, logoView.getVisibility());
- assertEquals(View.GONE, searchBoxView.getVisibility());
+ Assert.assertEquals(View.GONE, logoView.getVisibility());
+ Assert.assertEquals(View.GONE, searchBoxView.getVisibility());
}
});
mMostVisitedSites.setTileSuggestions(
@@ -429,8 +470,8 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
return mTileGridLayout.getChildCount() == 0;
}
});
- assertNotNull(ntpView.getPlaceholder());
- assertEquals(View.VISIBLE, ntpView.getPlaceholder().getVisibility());
+ Assert.assertNotNull(ntpView.getPlaceholder());
+ Assert.assertEquals(View.VISIBLE, ntpView.getPlaceholder().getVisibility());
// Once the search provider has a logo again, the logo and search box are shown again and
// the placeholder is hidden.
@@ -438,17 +479,17 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
@Override
public void run() {
ntpView.setSearchProviderHasLogo(true);
- assertEquals(View.VISIBLE, logoView.getVisibility());
- assertEquals(View.VISIBLE, searchBoxView.getVisibility());
- assertEquals(View.GONE, ntpView.getPlaceholder().getVisibility());
+ Assert.assertEquals(View.VISIBLE, logoView.getVisibility());
+ Assert.assertEquals(View.VISIBLE, searchBoxView.getVisibility());
+ Assert.assertEquals(View.GONE, ntpView.getPlaceholder().getVisibility());
}
});
}
private void assertThumbnailInvalidAndRecapture() {
- assertTrue(mNtp.shouldCaptureThumbnail());
+ Assert.assertTrue(mNtp.shouldCaptureThumbnail());
captureThumbnail();
- assertFalse(mNtp.shouldCaptureThumbnail());
+ Assert.assertFalse(mNtp.shouldCaptureThumbnail());
}
private void captureThumbnail() {
@@ -498,7 +539,7 @@ public class NewTabPageTest extends ChromeTabbedActivityTestBase {
private void clickFakebox() {
View fakebox = mNtp.getView().findViewById(R.id.search_box);
- singleClickView(fakebox);
+ TouchCommon.singleClickView(fakebox);
}
/**

Powered by Google App Engine
This is Rietveld 408576698