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

Side by Side Diff: content/renderer/render_widget_unittest.cc

Issue 1955643002: Add UMA metric to track the time saved on making events passive during fling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 EXPECT_CALL(*widget()->mock_webwidget(), handleInputEvent(_)) 320 EXPECT_CALL(*widget()->mock_webwidget(), handleInputEvent(_))
321 .WillOnce( 321 .WillOnce(
322 ::testing::Return(blink::WebInputEventResult::HandledApplication)); 322 ::testing::Return(blink::WebInputEventResult::HandledApplication));
323 touch.dispatchType = blink::WebInputEvent::DispatchType::Blocking; 323 touch.dispatchType = blink::WebInputEvent::DispatchType::Blocking;
324 widget()->SendInputEvent(touch); 324 widget()->SendInputEvent(touch);
325 histogram_tester().ExpectBucketCount( 325 histogram_tester().ExpectBucketCount(
326 EVENT_LISTENER_RESULT_HISTOGRAM, 326 EVENT_LISTENER_RESULT_HISTOGRAM,
327 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 1); 327 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 1);
328 } 328 }
329 329
330 TEST_F(RenderWidgetUnittest, TouchStartDuringOrOutsideFlingUmaMetrics) {
331 EXPECT_CALL(*widget()->mock_webwidget(), handleInputEvent(_))
332 .Times(2)
333 .WillRepeatedly(
334 ::testing::Return(blink::WebInputEventResult::NotHandled));
335
336 SyntheticWebTouchEvent touch;
337 touch.PressPoint(10, 10);
338 touch.dispatchType = blink::WebInputEvent::DispatchType::Blocking;
339 touch.dispatchedDuringFling = true;
340 widget()->SendInputEvent(touch);
341 histogram_tester().ExpectTotalCount(
342 "Event.Touch.TouchStartDuringFlingLatency", 1);
343
344 touch.dispatchedDuringFling = false;
345 widget()->SendInputEvent(touch);
346 histogram_tester().ExpectTotalCount(
347 "Event.Touch.TouchStartOutsideFlingLatency", 1);
348 }
349
330 } // namespace content 350 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698