| Index: third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| index ceef2be019e2cb1bdf7a2614319767e08b243576..eab65dce046b50f1852b9018bd032071cb2d3974 100644
|
| --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| @@ -10,6 +10,7 @@
|
| #include "core/editing/FrameSelection.h"
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| +#include "core/frame/Settings.h"
|
| #include "core/page/AutoscrollController.h"
|
| #include "core/page/Page.h"
|
| #include "core/testing/DummyPageHolder.h"
|
| @@ -240,4 +241,31 @@ TEST_F(EventHandlerTest, draggedSVGImagePositionTest)
|
| EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTransferLocationForTesting());
|
| }
|
|
|
| +// Regression test for http://crbug.com/641403 to verify we use up-to-date
|
| +// layout tree for dispatching "contextmenu" event.
|
| +TEST_F(EventHandlerTest, sendContextMenuEventWithHover)
|
| +{
|
| + setHtmlInnerHTML(
|
| + "<style>*:hover { color: red; }</style>"
|
| + "<div>foo</div>");
|
| + document().settings()->setScriptEnabled(true);
|
| + Element* script = document().createElement("script", ASSERT_NO_EXCEPTION);
|
| + script->setInnerHTML(
|
| + "document.addEventListener('contextmenu', event => event.preventDefault());",
|
| + ASSERT_NO_EXCEPTION);
|
| + document().body()->appendChild(script);
|
| + document().frame()->selection().setSelection(
|
| + VisibleSelection(Position(document().body(), 0)));
|
| + PlatformMouseEvent mouseDownEvent(
|
| + IntPoint(0, 0),
|
| + IntPoint(100, 200),
|
| + WebPointerProperties::Button::Right,
|
| + PlatformEvent::MousePressed,
|
| + 1,
|
| + PlatformEvent::Modifiers::RightButtonDown,
|
| + WTF::monotonicallyIncreasingTime());
|
| + EXPECT_EQ(WebInputEventResult::HandledApplication,
|
| + document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent));
|
| +}
|
| +
|
| } // namespace blink
|
|
|