Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.chrome.browser.suggestions; | |
| 6 | |
| 7 import android.os.SystemClock; | |
| 8 import android.support.test.filters.MediumTest; | |
| 9 import android.view.MotionEvent; | |
| 10 | |
| 11 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; | |
| 12 import org.chromium.chrome.test.BottomSheetTestCaseBase; | |
| 13 import org.chromium.content.browser.test.util.TestTouchUtils; | |
| 14 | |
| 15 /** | |
| 16 * Tests for the behaviour of the suggestions bottom sheet content. | |
|
Michael van Ouwerkerk
2017/02/03 20:20:33
How about this? "Instrumentation tests for {@code
dgn
2017/02/06 16:45:17
Done.
| |
| 17 */ | |
| 18 public class SuggestionsBottomSheetTest extends BottomSheetTestCaseBase { | |
| 19 @MediumTest | |
| 20 public void testContextMenu() throws InterruptedException { | |
| 21 // TODO(dgn): set the initial adapter content to avoid network dependent behaviour. | |
| 22 NewTabPageRecyclerView recyclerView = getRecyclerView(); | |
| 23 assertFalse(recyclerView.onInterceptTouchEvent(createTap())); | |
| 24 | |
| 25 TestTouchUtils.longClickView(getInstrumentation(), recyclerView.findFirs tCard().itemView); | |
|
Michael van Ouwerkerk
2017/02/03 20:20:33
Do we know for sure that the first card has been r
dgn
2017/02/06 16:45:18
Done.
| |
| 26 assertTrue(recyclerView.onInterceptTouchEvent(createTap())); | |
| 27 | |
| 28 getActivity().closeContextMenu(); | |
| 29 assertFalse(recyclerView.onInterceptTouchEvent(createTap())); | |
| 30 } | |
| 31 | |
| 32 private static MotionEvent createTap() { | |
|
Michael van Ouwerkerk
2017/02/03 20:20:33
Maybe "createTapEvent"?
dgn
2017/02/06 16:45:18
Done.
| |
| 33 return MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptime Millis(), | |
| 34 MotionEvent.ACTION_DOWN, 0f, 0f, 0); | |
| 35 } | |
| 36 | |
| 37 private NewTabPageRecyclerView getRecyclerView() { | |
| 38 return (NewTabPageRecyclerView) getBottomSheetContent().getScrollingCont entView(); | |
| 39 } | |
| 40 } | |
| OLD | NEW |