#include <string_view>
#include <tuple>
#include <utility>
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_reader.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/input/actions_parser.h"
#include "content/common/input/synthetic_gesture.h"
#include "content/common/input/synthetic_gesture_controller.h"
#include "content/common/input/synthetic_gesture_params.h"
#include "content/common/input/synthetic_gesture_target.h"
#include "content/common/input/synthetic_pointer_action.h"
#include "content/common/input/synthetic_pointer_action_list_params.h"
#include "content/common/input/synthetic_smooth_scroll_gesture.h"
#include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/hit_test_region_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/blink/blink_features.h"
#include "ui/latency/latency_info.h"
WebInputEvent;
namespace {
constexpr char kTouchActionDataURL[] = …;
constexpr char kTouchActionURLWithOverlapArea[] = …;
void GiveItSomeTime(int t) { … }
constexpr base::TimeDelta kNoJankTime = …;
constexpr base::TimeDelta kShortJankTime = …;
constexpr base::TimeDelta kLongJankTime = …;
}
namespace content {
class TouchActionBrowserTest : public ContentBrowserTest { … };
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_DefaultAuto …
#else
#define MAYBE_DefaultAuto …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_DefaultAuto) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER)
#define MAYBE_TouchActionNone …
#else
#define MAYBE_TouchActionNone …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_TouchActionNone) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanYMainThreadJanky …
#else
#define MAYBE_PanYMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanYMainThreadJanky) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXMainThreadJanky …
#else
#define MAYBE_PanXMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXMainThreadJanky) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_PanXAtYAreaWithTimeout …
#else
#define MAYBE_PanXAtYAreaWithTimeout …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXAtYAreaWithTimeout) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_TwoFingerPanXAtYAreaWithTimeout …
#else
#define MAYBE_TwoFingerPanXAtYAreaWithTimeout …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
MAYBE_TwoFingerPanXAtYAreaWithTimeout) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXYMainThreadJanky …
#else
#define MAYBE_PanXYMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_PanXYMainThreadJanky) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXYAtXAreaMainThreadJanky …
#else
#define MAYBE_PanXYAtXAreaMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
MAYBE_PanXYAtXAreaMainThreadJanky) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXYAtYAreaMainThreadJanky …
#else
#define MAYBE_PanXYAtYAreaMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
MAYBE_PanXYAtYAreaMainThreadJanky) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXYAtAutoYOverlapAreaMainThreadJanky …
#else
#define MAYBE_PanXYAtAutoYOverlapAreaMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
MAYBE_PanXYAtAutoYOverlapAreaMainThreadJanky) { … }
#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || \
defined(MEMORY_SANITIZER) || defined(LEAK_SANITIZER) || \
defined(THREAD_SANITIZER) || BUILDFLAG(IS_MAC)
#define MAYBE_PanXYAtAutoXOverlapAreaMainThreadJanky …
#else
#define MAYBE_PanXYAtAutoXOverlapAreaMainThreadJanky …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest,
MAYBE_PanXYAtAutoXOverlapAreaMainThreadJanky) { … }
#if BUILDFLAG(IS_ANDROID)
#define MAYBE_TwoFingerPanYDisallowed …
#else
#define MAYBE_TwoFingerPanYDisallowed …
#endif
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, MAYBE_TwoFingerPanYDisallowed) { … }
namespace {
const std::string kDoubleTapZoomDataURL = …;
}
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, BlockDoubleTapDragZoom) { … }
namespace {
constexpr char kContentEditableDataURL[] = …;
constexpr char kContentEditableHorizontalScrollableDataURL[] = …;
constexpr char kContentEditableNonPassiveHandlerDataURL[] = …;
constexpr char kInputTagCursorControl[] = …;
}
class TouchActionBrowserTestEnableCursorControl
: public TouchActionBrowserTest { … };
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTestEnableCursorControl,
BasicCursorControl) { … }
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTestEnableCursorControl,
NoCursorControlForHorizontalScrollable) { … }
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTestEnableCursorControl,
NoCursorControlForNonPassiveLisenter) { … }
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTestEnableCursorControl,
CursorControlOnInput) { … }
IN_PROC_BROWSER_TEST_F(TouchActionBrowserTestEnableCursorControl,
NoCursorControlOnHorizontalScrollableInput) { … }
}