Commit 503c4b50 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fieldtrial configuration for gesture navigation

This CL adds fieldtrial configuration json entry for gesture
navigation in preparation of beta experiment.

Bug: 1006111
Change-Id: I304e60985362cc74d9215cd2d84cfb796e92c517
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815965Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699534}
parent 00d48218
...@@ -158,7 +158,11 @@ public class NavigationPopupTest { ...@@ -158,7 +158,11 @@ public class NavigationPopupTest {
@MediumTest @MediumTest
@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Navigation"}) @Feature({"Navigation"})
public void testLongPressBackTriggering() throws ExecutionException { @CommandLineFlags.Add({"force-fieldtrials=GestureNavigation/Disabled",
"force-fieldtrial-params=GestureNavigation.Disabled:"
+ "overscroll_history_navigation_bottom_sheet/false"})
public void
testLongPressBackTriggering() throws ExecutionException {
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { mActivityTestRule.getActivity().onKeyDown(KeyEvent.KEYCODE_BACK, event); }); () -> { mActivityTestRule.getActivity().onKeyDown(KeyEvent.KEYCODE_BACK, event); });
...@@ -174,7 +178,11 @@ public class NavigationPopupTest { ...@@ -174,7 +178,11 @@ public class NavigationPopupTest {
@SmallTest @SmallTest
@Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE)
@Feature({"Navigation"}) @Feature({"Navigation"})
public void testLongPressBackTriggering_Cancellation() throws ExecutionException { @CommandLineFlags.Add({"force-fieldtrials=GestureNavigation/Disabled",
"force-fieldtrial-params=GestureNavigation.Disabled:"
+ "overscroll_history_navigation_bottom_sheet/false"})
public void
testLongPressBackTriggering_Cancellation() throws ExecutionException {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
mActivityTestRule.getActivity().onKeyDown(KeyEvent.KEYCODE_BACK, event); mActivityTestRule.getActivity().onKeyDown(KeyEvent.KEYCODE_BACK, event);
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.feed; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.feed;
import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeLeft;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist; import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches; import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
...@@ -20,6 +19,11 @@ import static org.chromium.chrome.test.util.ViewUtils.VIEW_NULL; ...@@ -20,6 +19,11 @@ import static org.chromium.chrome.test.util.ViewUtils.VIEW_NULL;
import static org.chromium.chrome.test.util.ViewUtils.waitForView; import static org.chromium.chrome.test.util.ViewUtils.waitForView;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.action.GeneralLocation;
import android.support.test.espresso.action.GeneralSwipeAction;
import android.support.test.espresso.action.Press;
import android.support.test.espresso.action.Swipe;
import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.filters.MediumTest; import android.support.test.filters.MediumTest;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -73,6 +77,12 @@ public class FeedNewTabPageTest { ...@@ -73,6 +77,12 @@ public class FeedNewTabPageTest {
private static final int ARTICLE_SECTION_HEADER_POSITION = 1; private static final int ARTICLE_SECTION_HEADER_POSITION = 1;
private static final int SIGNIN_PROMO_POSITION = 2; private static final int SIGNIN_PROMO_POSITION = 2;
// Espresso ViewAction that performs a swipe from center to left across the vertical center
// of the view. Used instead of ViewAction.swipeLeft which swipes from right edge to
// avoid conflict with gesture navigation UI which consumes the edge swipe.
private static final ViewAction SWIPE_LEFT = new GeneralSwipeAction(
Swipe.FAST, GeneralLocation.CENTER, GeneralLocation.CENTER_LEFT, Press.FINGER);
@Rule @Rule
public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule();
...@@ -181,7 +191,7 @@ public class FeedNewTabPageTest { ...@@ -181,7 +191,7 @@ public class FeedNewTabPageTest {
// Swipe away the sign-in promo. // Swipe away the sign-in promo.
onView(instanceOf(RecyclerView.class)) onView(instanceOf(RecyclerView.class))
.perform(RecyclerViewActions.actionOnItemAtPosition( .perform(RecyclerViewActions.actionOnItemAtPosition(
SIGNIN_PROMO_POSITION, swipeLeft())); SIGNIN_PROMO_POSITION, SWIPE_LEFT));
ViewGroup view = (ViewGroup) mNtp.getCoordinatorForTesting().getStream().getView(); ViewGroup view = (ViewGroup) mNtp.getCoordinatorForTesting().getStream().getView();
waitForView(view, withId(R.id.signin_promo_view_container), VIEW_NULL); waitForView(view, withId(R.id.signin_promo_view_container), VIEW_NULL);
......
...@@ -2641,6 +2641,24 @@ ...@@ -2641,6 +2641,24 @@
] ]
} }
], ],
"GestureNavigation": [
{
"platforms": [
"android"
],
"experiments": [
{
"name": "Enabled",
"params": {
"overscroll_history_navigation_bottom_sheet": "true"
},
"enable_features": [
"OverscrollHistoryNavigation"
]
}
]
}
],
"GlobalMediaControlsInProductHelp": [ "GlobalMediaControlsInProductHelp": [
{ {
"platforms": [ "platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment