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

Side by Side Diff: content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc

Issue 2788893004: Renaming gpu swap buffer callbacks and the screenshot latency component. (Closed)
Patch Set: Updating android compositor Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/test/histogram_tester.h" 5 #include "base/test/histogram_tester.h"
6 #include "components/rappor/public/rappor_utils.h" 6 #include "components/rappor/public/rappor_utils.h"
7 #include "components/rappor/test_rappor_service.h" 7 #include "components/rappor/test_rappor_service.h"
8 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h" 8 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker .h"
9 #include "content/common/input/synthetic_web_input_event_builders.h" 9 #include "content/common/input/synthetic_web_input_event_builders.h"
10 #include "content/public/browser/native_web_keyboard_event.h" 10 #include "content/public/browser/native_web_keyboard_event.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now); 195 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now);
196 tracker()->OnInputEvent(wheel, &wheel_latency); 196 tracker()->OnInputEvent(wheel, &wheel_latency);
197 EXPECT_TRUE(wheel_latency.FindLatency( 197 EXPECT_TRUE(wheel_latency.FindLatency(
198 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 198 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
199 tracker()->latency_component_id(), nullptr)); 199 tracker()->latency_component_id(), nullptr));
200 EXPECT_TRUE(wheel_latency.FindLatency( 200 EXPECT_TRUE(wheel_latency.FindLatency(
201 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 201 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
202 EXPECT_EQ(1U, wheel_latency.input_coordinates_size()); 202 EXPECT_EQ(1U, wheel_latency.input_coordinates_size());
203 tracker()->OnInputEventAck(wheel, &wheel_latency, 203 tracker()->OnInputEventAck(wheel, &wheel_latency,
204 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 204 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
205 tracker()->OnFrameSwapped(wheel_latency); 205 tracker()->OnGpuSwapBuffersCompleted(wheel_latency);
206 206
207 // Rappor metrics. 207 // Rappor metrics.
208 EXPECT_TRUE( 208 EXPECT_TRUE(
209 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch." 209 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch."
210 "TimeToScrollUpdateSwapBegin2", 210 "TimeToScrollUpdateSwapBegin2",
211 0)); 211 0));
212 EXPECT_TRUE( 212 EXPECT_TRUE(
213 RapporSampleAssert("Event.Latency.ScrollBegin.Touch." 213 RapporSampleAssert("Event.Latency.ScrollBegin.Touch."
214 "TimeToScrollUpdateSwapBegin2", 214 "TimeToScrollUpdateSwapBegin2",
215 0)); 215 0));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now); 287 AddRenderingScheduledComponent(&wheel_latency, rendering_on_main, now);
288 tracker()->OnInputEvent(wheel, &wheel_latency); 288 tracker()->OnInputEvent(wheel, &wheel_latency);
289 EXPECT_TRUE(wheel_latency.FindLatency( 289 EXPECT_TRUE(wheel_latency.FindLatency(
290 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 290 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
291 tracker()->latency_component_id(), nullptr)); 291 tracker()->latency_component_id(), nullptr));
292 EXPECT_TRUE(wheel_latency.FindLatency( 292 EXPECT_TRUE(wheel_latency.FindLatency(
293 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 293 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
294 EXPECT_EQ(1U, wheel_latency.input_coordinates_size()); 294 EXPECT_EQ(1U, wheel_latency.input_coordinates_size());
295 tracker()->OnInputEventAck(wheel, &wheel_latency, 295 tracker()->OnInputEventAck(wheel, &wheel_latency,
296 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 296 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
297 tracker()->OnFrameSwapped(wheel_latency); 297 tracker()->OnGpuSwapBuffersCompleted(wheel_latency);
298 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1)); 298 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelUI", 1));
299 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1)); 299 EXPECT_TRUE(HistogramSizeEq("Event.Latency.Browser.WheelAcked", 1));
300 300
301 EXPECT_TRUE( 301 EXPECT_TRUE(
302 HistogramSizeEq("Event.Latency.ScrollBegin.Wheel." 302 HistogramSizeEq("Event.Latency.ScrollBegin.Wheel."
303 "TimeToScrollUpdateSwapBegin2", 303 "TimeToScrollUpdateSwapBegin2",
304 0)); 304 0));
305 EXPECT_TRUE(HistogramSizeEq( 305 EXPECT_TRUE(HistogramSizeEq(
306 "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Main", 0)); 306 "Event.Latency.ScrollBegin.Wheel.TimeToHandled2_Main", 0));
307 EXPECT_TRUE(HistogramSizeEq( 307 EXPECT_TRUE(HistogramSizeEq(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now); 385 AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now);
386 tracker()->OnInputEvent(touch, &touch_latency); 386 tracker()->OnInputEvent(touch, &touch_latency);
387 EXPECT_TRUE(touch_latency.FindLatency( 387 EXPECT_TRUE(touch_latency.FindLatency(
388 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 388 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
389 tracker()->latency_component_id(), nullptr)); 389 tracker()->latency_component_id(), nullptr));
390 EXPECT_TRUE(touch_latency.FindLatency( 390 EXPECT_TRUE(touch_latency.FindLatency(
391 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 391 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
392 EXPECT_EQ(2U, touch_latency.input_coordinates_size()); 392 EXPECT_EQ(2U, touch_latency.input_coordinates_size());
393 tracker()->OnInputEventAck(touch, &touch_latency, 393 tracker()->OnInputEventAck(touch, &touch_latency,
394 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 394 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
395 tracker()->OnFrameSwapped(touch_latency); 395 tracker()->OnGpuSwapBuffersCompleted(touch_latency);
396 } 396 }
397 397
398 // Rappor metrics. 398 // Rappor metrics.
399 EXPECT_TRUE( 399 EXPECT_TRUE(
400 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch." 400 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch."
401 "TimeToScrollUpdateSwapBegin2", 401 "TimeToScrollUpdateSwapBegin2",
402 0)); 402 0));
403 EXPECT_TRUE( 403 EXPECT_TRUE(
404 RapporSampleAssert("Event.Latency.ScrollBegin.Touch." 404 RapporSampleAssert("Event.Latency.ScrollBegin.Touch."
405 "TimeToScrollUpdateSwapBegin2", 405 "TimeToScrollUpdateSwapBegin2",
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now); 505 AddRenderingScheduledComponent(&touch_latency, rendering_on_main, now);
506 tracker()->OnInputEvent(touch, &touch_latency); 506 tracker()->OnInputEvent(touch, &touch_latency);
507 EXPECT_TRUE(touch_latency.FindLatency( 507 EXPECT_TRUE(touch_latency.FindLatency(
508 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 508 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT,
509 tracker()->latency_component_id(), nullptr)); 509 tracker()->latency_component_id(), nullptr));
510 EXPECT_TRUE(touch_latency.FindLatency( 510 EXPECT_TRUE(touch_latency.FindLatency(
511 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr)); 511 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, nullptr));
512 EXPECT_EQ(2U, touch_latency.input_coordinates_size()); 512 EXPECT_EQ(2U, touch_latency.input_coordinates_size());
513 tracker()->OnInputEventAck(touch, &touch_latency, 513 tracker()->OnInputEventAck(touch, &touch_latency,
514 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 514 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
515 tracker()->OnFrameSwapped(touch_latency); 515 tracker()->OnGpuSwapBuffersCompleted(touch_latency);
516 } 516 }
517 517
518 // Rappor metrics. 518 // Rappor metrics.
519 EXPECT_TRUE( 519 EXPECT_TRUE(
520 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch." 520 RapporSampleAssert("Event.Latency.ScrollUpdate.Touch."
521 "TimeToScrollUpdateSwapBegin2", 521 "TimeToScrollUpdateSwapBegin2",
522 2)); 522 2));
523 EXPECT_TRUE( 523 EXPECT_TRUE(
524 RapporSampleAssert("Event.Latency.ScrollBegin.Touch." 524 RapporSampleAssert("Event.Latency.ScrollBegin.Touch."
525 "TimeToScrollUpdateSwapBegin2", 525 "TimeToScrollUpdateSwapBegin2",
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 SyntheticWebTouchEvent touch; 609 SyntheticWebTouchEvent touch;
610 touch.PressPoint(0, 0); 610 touch.PressPoint(0, 0);
611 ui::LatencyInfo touch_latency; 611 ui::LatencyInfo touch_latency;
612 AddFakeComponents(*tracker(), &touch_latency); 612 AddFakeComponents(*tracker(), &touch_latency);
613 tracker()->OnInputEvent(touch, &touch_latency); 613 tracker()->OnInputEvent(touch, &touch_latency);
614 tracker()->OnInputEventAck(touch, &touch_latency, 614 tracker()->OnInputEventAck(touch, &touch_latency,
615 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 615 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
616 EXPECT_TRUE(touch_latency.FindLatency( 616 EXPECT_TRUE(touch_latency.FindLatency(
617 ui::INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, 0, nullptr)); 617 ui::INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, 0, nullptr));
618 EXPECT_TRUE(touch_latency.terminated()); 618 EXPECT_TRUE(touch_latency.terminated());
619 tracker()->OnFrameSwapped(touch_latency); 619 tracker()->OnGpuSwapBuffersCompleted(touch_latency);
620 } 620 }
621 621
622 { 622 {
623 auto mouse_move = SyntheticWebMouseEventBuilder::Build( 623 auto mouse_move = SyntheticWebMouseEventBuilder::Build(
624 blink::WebMouseEvent::MouseMove); 624 blink::WebMouseEvent::MouseMove);
625 ui::LatencyInfo mouse_latency; 625 ui::LatencyInfo mouse_latency;
626 AddFakeComponents(*tracker(), &mouse_latency); 626 AddFakeComponents(*tracker(), &mouse_latency);
627 tracker()->OnInputEvent(mouse_move, &mouse_latency); 627 tracker()->OnInputEvent(mouse_move, &mouse_latency);
628 tracker()->OnInputEventAck(mouse_move, &mouse_latency, 628 tracker()->OnInputEventAck(mouse_move, &mouse_latency,
629 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 629 INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"), 960 "Event.Latency.BlockingTime.TouchEndDefaultPrevented"),
961 ElementsAre(Bucket( 961 ElementsAre(Bucket(
962 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 962 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
963 EXPECT_THAT(histogram_tester().GetAllSamples( 963 EXPECT_THAT(histogram_tester().GetAllSamples(
964 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"), 964 "Event.Latency.BlockingTime.TouchEndDefaultAllowed"),
965 ElementsAre(Bucket( 965 ElementsAre(Bucket(
966 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1))); 966 touchend_timestamps_ms[2] - touchend_timestamps_ms[1], 1)));
967 } 967 }
968 968
969 } // namespace content 969 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698