Commit 12592d43 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Parameterize some tests using kCompositorTouchAction

This CL parameterize some tests using this flag. It does 2 things:
1. Move the kCompositorTouchAction flag from content/ to ui/events/blink.
This is because InputHandlerProxy will need to have access to this flag,
and that content/ depends on ui/events/blink.
2. Parameterize necessary tests based on this flag. Tests include:
InputRouterImplTest, TouchActionFilterTest, InputHandlerProxyTest,
TouchActionBrowserTest.

In order to pameterize the InputRouterImplTest, we have to extract a
InputRouterImplTestBase. The reason is that InputRouterImplTest has a
subclass "TouchpadPinchInputRouterImplTest", which is already a
parameterized test depending on another flag.

Bug: 900202
Change-Id: I07e30739ee86aaf8b1840d6e0dccfc504a16b075
Reviewed-on: https://chromium-review.googlesource.com/c/1307833
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604491}
parent a1b1bcd1
......@@ -111,7 +111,7 @@ class CONTENT_EXPORT InputRouterImpl : public InputRouter,
void ForceResetTouchActionForTest();
private:
friend class InputRouterImplTest;
friend class InputRouterImplTestBase;
friend class MockRenderWidgetHost;
friend class RenderWidgetHostSitePerProcessTest;
friend class SitePerProcessBrowserTouchActionTest;
......
......@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/input/synthetic_gesture.h"
#include "content/browser/renderer_host/input/synthetic_gesture_controller.h"
......@@ -33,6 +34,7 @@
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/events/blink/blink_features.h"
#include "ui/latency/latency_info.h"
using blink::WebInputEvent;
......@@ -130,10 +132,15 @@ constexpr base::TimeDelta kLongJankTime =
namespace content {
class TouchActionBrowserTest : public ContentBrowserTest {
class TouchActionBrowserTest : public ContentBrowserTest,
public testing::WithParamInterface<bool> {
public:
TouchActionBrowserTest() {}
TouchActionBrowserTest() {
if (GetParam())
feature_list_.InitAndEnableFeature(features::kCompositorTouchAction);
else
feature_list_.InitAndDisableFeature(features::kCompositorTouchAction);
}
~TouchActionBrowserTest() override {}
RenderWidgetHostImpl* GetWidgetHost() {
......@@ -428,10 +435,13 @@ class TouchActionBrowserTest : public ContentBrowserTest {
private:
std::unique_ptr<RenderFrameSubmissionObserver> frame_observer_;
std::unique_ptr<base::RunLoop> run_loop_;
base::test::ScopedFeatureList feature_list_;
DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest);
};
INSTANTIATE_TEST_CASE_P(, TouchActionBrowserTest, testing::Bool());
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER)
......@@ -442,7 +452,7 @@ class TouchActionBrowserTest : public ContentBrowserTest {
//
// Verify the test infrastructure works - we can touch-scroll the page and get a
// touchcancel as expected.
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_DefaultAuto) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_DefaultAuto) {
LoadURL(kTouchActionDataURL);
DoTouchScroll(gfx::Point(50, 50), gfx::Vector2d(0, 45), true, 10200,
......@@ -463,7 +473,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_DefaultAuto) {
#else
#define MAYBE_TouchActionNone TouchActionNone
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_TouchActionNone) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_TouchActionNone) {
LoadURL(kTouchActionDataURL);
DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45), false, 10200,
......@@ -482,7 +492,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_TouchActionNone) {
#else
#define MAYBE_PanYMainThreadJanky PanYMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanYMainThreadJanky) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_PanYMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
DoTouchScroll(gfx::Point(25, 125), gfx::Vector2d(0, 45), false, 10000,
......@@ -496,7 +506,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanYMainThreadJanky) {
#else
#define MAYBE_PanXMainThreadJanky PanXMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXMainThreadJanky) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_PanXMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
DoTouchScroll(gfx::Point(125, 25), gfx::Vector2d(45, 0), false, 10000,
......@@ -510,7 +520,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXMainThreadJanky) {
#endif
// When touch ack timeout is triggered, the panx gesture will be allowed even
// though we touch the pany area.
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXAtYAreaWithTimeout) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_PanXAtYAreaWithTimeout) {
LoadURL(kTouchActionURLWithOverlapArea);
DoTouchScroll(gfx::Point(25, 125), gfx::Vector2d(45, 0), false, 10000,
......@@ -525,7 +535,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXAtYAreaWithTimeout) {
#endif
// When touch ack timeout is triggered, the panx gesture will be allowed even
// though we touch the pany area.
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest,
MAYBE_TwoFingerPanXAtYAreaWithTimeout) {
LoadURL(kTouchActionURLWithOverlapArea);
......@@ -539,7 +549,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
#else
#define MAYBE_PanXYMainThreadJanky PanXYMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXYMainThreadJanky) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_PanXYMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
DoTouchScroll(gfx::Point(75, 60), gfx::Vector2d(45, 45), false, 10000,
......@@ -553,7 +563,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXYMainThreadJanky) {
#else
#define MAYBE_PanXYAtXAreaMainThreadJanky PanXYAtXAreaMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest,
MAYBE_PanXYAtXAreaMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
......@@ -568,7 +578,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
#else
#define MAYBE_PanXYAtYAreaMainThreadJanky PanXYAtYAreaMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest,
MAYBE_PanXYAtYAreaMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
......@@ -585,7 +595,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
#define MAYBE_PanXYAtAutoYOverlapAreaMainThreadJanky \
PanXYAtAutoYOverlapAreaMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest,
MAYBE_PanXYAtAutoYOverlapAreaMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
......@@ -602,7 +612,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
#define MAYBE_PanXYAtAutoXOverlapAreaMainThreadJanky \
PanXYAtAutoXOverlapAreaMainThreadJanky
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest,
MAYBE_PanXYAtAutoXOverlapAreaMainThreadJanky) {
LoadURL(kTouchActionURLWithOverlapArea);
......@@ -618,7 +628,7 @@ IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
#endif
// Test that two finger panning is treated as pinch zoom and is disallowed when
// touching the pan-y area.
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_TwoFingerPanYDisallowed) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, MAYBE_TwoFingerPanYDisallowed) {
LoadURL(kTouchActionURLWithOverlapArea);
DoTwoFingerPan();
......@@ -647,7 +657,7 @@ const std::string kDoubleTapZoomDataURL = R"HTML(
// Test that |touch-action: none| correctly blocks a double-tap and drag zoom
// gesture.
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, BlockDoubleTapDragZoom) {
IN_PROC_BROWSER_TEST_P(TouchActionBrowserTest, BlockDoubleTapDragZoom) {
LoadURL(kDoubleTapZoomDataURL.c_str());
ASSERT_EQ(1, ExecuteScriptAndExtractDouble("window.visualViewport.scale"));
......
......@@ -68,7 +68,7 @@ class CONTENT_EXPORT TouchActionFilter {
void AppendToGestureSequenceForDebugging(const char* str);
private:
friend class InputRouterImplTest;
friend class InputRouterImplTestBase;
friend class MockRenderWidgetHost;
friend class TouchActionFilterTest;
friend class TouchActionFilterPinchTest;
......
......@@ -116,11 +116,6 @@ const base::Feature kCompositeOpaqueFixedPosition{
const base::Feature kCompositeOpaqueScrollers{"CompositeOpaqueScrollers",
base::FEATURE_ENABLED_BY_DEFAULT};
// Enables handling touch events in compositor using impl side touch action
// knowledge.
const base::Feature kCompositorTouchAction{"CompositorTouchAction",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables crash reporting via Reporting API.
// https://www.w3.org/TR/reporting/#crash-report
const base::Feature kCrashReporting{"CrashReporting",
......
......@@ -36,7 +36,6 @@ CONTENT_EXPORT extern const base::Feature kCacheInlineScriptCode;
CONTENT_EXPORT extern const base::Feature kCanvas2DImageChromium;
CONTENT_EXPORT extern const base::Feature kCompositeOpaqueFixedPosition;
CONTENT_EXPORT extern const base::Feature kCompositeOpaqueScrollers;
CONTENT_EXPORT extern const base::Feature kCompositorTouchAction;
CONTENT_EXPORT extern const base::Feature kCrashReporting;
CONTENT_EXPORT extern const base::Feature kCSSFragmentIdentifiers;
CONTENT_EXPORT extern const base::Feature kDataSaverHoldback;
......
......@@ -1011,6 +1011,7 @@ test("content_browsertests") {
"//ui/compositor",
"//ui/display",
"//ui/events:test_support",
"//ui/events/blink:blink",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/gl",
......
......@@ -25,4 +25,7 @@ const base::Feature kNoHoverAfterLayoutChange{
const base::Feature kNoHoverDuringScroll{"NoHoverDuringScroll",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kCompositorTouchAction{"CompositorTouchAction",
base::FEATURE_DISABLED_BY_DEFAULT};
}
......@@ -35,6 +35,10 @@ extern const base::Feature kNoHoverAfterLayoutChange;
// dispatching mouse enter/exit events for elements under the mouse as the page
// is scrolled.
extern const base::Feature kNoHoverDuringScroll;
// Enables handling touch events in compositor using impl side touch action
// knowledge.
extern const base::Feature kCompositorTouchAction;
}
#endif // UI_EVENTS_BLINK_BLINK_FEATURES_H_
......@@ -63,10 +63,21 @@ enum InputHandlerProxyTestType {
ROOT_SCROLL_SYNCHRONOUS_HANDLER,
CHILD_SCROLL_NORMAL_HANDLER,
CHILD_SCROLL_SYNCHRONOUS_HANDLER,
COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_NORMAL,
COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_SYNCHRONOUS,
COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_NORMAL,
COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_SYNCHRONOUS,
};
static const InputHandlerProxyTestType test_types[] = {
ROOT_SCROLL_NORMAL_HANDLER, ROOT_SCROLL_SYNCHRONOUS_HANDLER,
CHILD_SCROLL_NORMAL_HANDLER, CHILD_SCROLL_SYNCHRONOUS_HANDLER};
ROOT_SCROLL_NORMAL_HANDLER,
ROOT_SCROLL_SYNCHRONOUS_HANDLER,
CHILD_SCROLL_NORMAL_HANDLER,
CHILD_SCROLL_SYNCHRONOUS_HANDLER,
COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_NORMAL,
COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_SYNCHRONOUS,
COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_NORMAL,
COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_SYNCHRONOUS,
};
MATCHER_P(WheelEventsMatch, expected, "") {
return WheelEventsMatch(arg, expected);
......@@ -287,11 +298,22 @@ class InputHandlerProxyTest
public testing::WithParamInterface<InputHandlerProxyTestType> {
public:
InputHandlerProxyTest()
: synchronous_root_scroll_(GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER),
: synchronous_root_scroll_(
GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_SYNCHRONOUS),
install_synchronous_handler_(
GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER ||
GetParam() == CHILD_SCROLL_SYNCHRONOUS_HANDLER),
GetParam() == CHILD_SCROLL_SYNCHRONOUS_HANDLER ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_SYNCHRONOUS ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_SYNCHRONOUS),
expected_disposition_(InputHandlerProxy::DID_HANDLE) {
if (GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_NORMAL ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_ROOT_SYNCHRONOUS ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_NORMAL ||
GetParam() == COMPOSITOR_TOUCH_ACTION_ENABLED_CHILD_SYNCHRONOUS)
feature_list_.InitAndEnableFeature(features::kCompositorTouchAction);
else
feature_list_.InitAndDisableFeature(features::kCompositorTouchAction);
input_handler_.reset(
new TestInputHandlerProxy(&mock_input_handler_, &mock_client_));
scroll_result_did_scroll_.did_scroll = true;
......@@ -374,6 +396,9 @@ class InputHandlerProxyTest
base::HistogramTester histogram_tester_;
cc::InputHandlerScrollResult scroll_result_did_scroll_;
cc::InputHandlerScrollResult scroll_result_did_not_scroll_;
private:
base::test::ScopedFeatureList feature_list_;
};
class InputHandlerProxyEventQueueTest : public testing::Test {
......
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