| 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 f8618151f6be13253f4f4efeefa617b8fe13d3b2..a2b873d30b1cf005e193218450d3fa977d46ceca 100644
|
| --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
|
| @@ -16,6 +16,7 @@
|
| #include "core/page/AutoscrollController.h"
|
| #include "core/page/Page.h"
|
| #include "core/testing/DummyPageHolder.h"
|
| +#include "platform/testing/HistogramTester.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace blink {
|
| @@ -79,6 +80,22 @@ class MousePressEventBuilder : public WebMouseEvent {
|
| }
|
| };
|
|
|
| +class ScrollBeginEventBuilder : public WebGestureEvent {
|
| + public:
|
| + ScrollBeginEventBuilder(IntPoint position,
|
| + FloatPoint delta,
|
| + WebGestureDevice device)
|
| + : WebGestureEvent() {
|
| + m_type = WebInputEvent::GestureScrollBegin;
|
| + x = globalX = position.x();
|
| + y = globalY = position.y();
|
| + data.scrollBegin.deltaYHint = delta.y();
|
| + data.scrollBegin.targetViewport = true;
|
| + sourceDevice = device;
|
| + m_frameScale = 1;
|
| + }
|
| +};
|
| +
|
| void EventHandlerTest::SetUp() {
|
| m_dummyPageHolder = DummyPageHolder::create(IntSize(300, 400));
|
| }
|
| @@ -461,6 +478,34 @@ TEST_F(EventHandlerTest, dragEndInNewDrag) {
|
| // This test passes if it doesn't crash.
|
| }
|
|
|
| +TEST_F(EventHandlerTest,
|
| + ScrollerSizeOfMainThreadScrollingHistogramRecordingTest) {
|
| + setHtmlInnerHTML(
|
| + "<style>.box { width: 100px; height: 100px; overflow: scroll;"
|
| + " opacity: 0.5; } .spacer { height: 1000px;} body {height: 1000px; }"
|
| + "</style>"
|
| + "<div class='box'><div id='content' class='spacer'></div></div>");
|
| +
|
| + HistogramTester histogramTester;
|
| +
|
| + // Test wheel scroll on the box
|
| + ScrollBeginEventBuilder wheelScrollBegin(
|
| + IntPoint(50, 50), FloatPoint(0.f, 1.f), WebGestureDeviceTouchpad);
|
| +
|
| + document().frame()->eventHandler().handleGestureEvent(wheelScrollBegin);
|
| + histogramTester.expectTotalCount("Event.Scroll.Wheel.ScrollerSize", 1);
|
| + histogramTester.expectBucketCount("Event.Scroll.Wheel.ScrollerSize", 10000,
|
| + 1);
|
| +
|
| + // Test touch scroll on the main frame
|
| + ScrollBeginEventBuilder touchScrollBegin(
|
| + IntPoint(200, 200), FloatPoint(0.f, 1.f), WebGestureDeviceTouchscreen);
|
| + document().frame()->eventHandler().handleGestureEvent(touchScrollBegin);
|
| + histogramTester.expectTotalCount("Event.Scroll.Touch.ScrollerSize", 1);
|
| + histogramTester.expectBucketCount("Event.Scroll.Touch.ScrollerSize", 90000,
|
| + 1);
|
| +}
|
| +
|
| class TooltipCapturingChromeClient : public EmptyChromeClient {
|
| public:
|
| TooltipCapturingChromeClient() {}
|
|
|