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

Unified Diff: chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 9 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/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
diff --git a/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc b/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
index 7448ccf4030c1114c117c2819bae9a5e3291c308..90a3b11f0c3ed608f5980ec3eaddb153a10808a0 100644
--- a/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
+++ b/chrome/browser/ui/views/apps/shaped_app_window_targeter_unittest.cc
@@ -67,9 +67,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
{
// Without any custom shapes, the event should be targeted correctly to the
// window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40),
- gfx::Point(40, 40), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(40, 40), gfx::Point(40, 40),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -81,9 +82,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
{
// With an empty custom shape, all events within the window should fall
// through to the root window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40),
- gfx::Point(40, 40), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(40, 40), gfx::Point(40, 40),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(root_window(), move.target());
@@ -105,17 +107,19 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestBasic) {
{
// With the custom shape, the events that don't fall within the custom shape
// will go through to the root window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40),
- gfx::Point(40, 40), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(40, 40), gfx::Point(40, 40),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(root_window(), move.target());
// But events within the shape will still reach the window.
- ui::MouseEvent move2(ui::ET_MOUSE_MOVED, gfx::Point(80, 80),
- gfx::Point(80, 80), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move2(
+ ui::ET_MOUSE_MOVED, gfx::Point(80, 80), gfx::Point(80, 80),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
details = event_sink()->OnEventFromSource(&move2);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move2.target());
@@ -134,9 +138,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
{
// Without any custom shapes, an event within the window bounds should be
// targeted correctly to the window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(40, 40),
- gfx::Point(40, 40), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(40, 40), gfx::Point(40, 40),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -145,9 +150,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
// Without any custom shapes, an event that falls just outside the window
// bounds should also be targeted correctly to the window, because of the
// targeter installed on the root-window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
- gfx::Point(10, 10), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -160,9 +166,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
{
// With the custom shape, the events that don't fall within the custom shape
// will go through to the root window.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
- gfx::Point(10, 10), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(root_window(), move.target());
@@ -172,9 +179,10 @@ TEST_F(ShapedAppWindowTargeterTest, HitTestOnlyForShapedWindow) {
// app window for events just outside its bounds.
app_window()->UpdateShape(std::unique_ptr<SkRegion>());
{
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
- gfx::Point(10, 10), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(10, 10), gfx::Point(10, 10),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -188,9 +196,10 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
{
// An event in the center of the window should always have
// |window| as its target.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(80, 80),
- gfx::Point(80, 80), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(80, 80), gfx::Point(80, 80),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -199,9 +208,10 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
// Without an EasyResizeTargeter on the container, an event
// inside the window and within 5px of an edge should have
// |window| as its target.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(32, 37),
- gfx::Point(32, 37), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(32, 37), gfx::Point(32, 37),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -227,9 +237,10 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
// RenderWidgetHostViewAura, we cannot differentiate the two cases. Fix
// the test environment so that the test can assert that non-border events
// bubble down to a child of |window|.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(80, 80),
- gfx::Point(80, 80), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(80, 80), gfx::Point(80, 80),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());
@@ -238,9 +249,10 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
// With an EasyResizeTargeter on the container, an event
// inside the window and within 5px of an edge should have
// |window| as its target.
- ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(32, 37),
- gfx::Point(32, 37), ui::EventTimeForNow(), ui::EF_NONE,
- ui::EF_NONE);
+ ui::MouseEvent move(
+ ui::ET_MOUSE_MOVED, gfx::Point(32, 37), gfx::Point(32, 37),
+ ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE,
+ ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
ui::EventDispatchDetails details = event_sink()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(window, move.target());

Powered by Google App Engine
This is Rietveld 408576698