OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 4062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4073 // Ensure the only components around are the ones we add. | 4073 // Ensure the only components around are the ones we add. |
4074 press1.latency()->Clear(); | 4074 press1.latency()->Clear(); |
4075 | 4075 |
4076 press1.latency()->AddLatencyNumberWithTimestamp( | 4076 press1.latency()->AddLatencyNumberWithTimestamp( |
4077 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, time_original, 1); | 4077 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0, time_original, 1); |
4078 | 4078 |
4079 press1.latency()->AddLatencyNumberWithTimestamp( | 4079 press1.latency()->AddLatencyNumberWithTimestamp( |
4080 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0, time_ui, 1); | 4080 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0, time_ui, 1); |
4081 | 4081 |
4082 press1.latency()->AddLatencyNumberWithTimestamp( | 4082 press1.latency()->AddLatencyNumberWithTimestamp( |
4083 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0, time_acked, 1); | 4083 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, 0, time_acked, 1); |
4084 | 4084 |
4085 DispatchEventUsingWindowDispatcher(&press1); | 4085 DispatchEventUsingWindowDispatcher(&press1); |
4086 EXPECT_TRUE(delegate->tap_down()); | 4086 EXPECT_TRUE(delegate->tap_down()); |
4087 | 4087 |
4088 ui::LatencyInfo::LatencyComponent component; | 4088 ui::LatencyInfo::LatencyComponent component; |
4089 | 4089 |
4090 EXPECT_EQ(3U, delegate->latency_info().latency_components.size()); | 4090 EXPECT_EQ(3U, delegate->latency_info().latency_components.size()); |
4091 ASSERT_TRUE(delegate->latency_info().FindLatency( | 4091 ASSERT_TRUE(delegate->latency_info().FindLatency( |
4092 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component)); | 4092 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, &component)); |
4093 EXPECT_EQ(time_original, component.event_time); | 4093 EXPECT_EQ(time_original, component.event_time); |
4094 | 4094 |
4095 ASSERT_TRUE(delegate->latency_info().FindLatency( | 4095 ASSERT_TRUE(delegate->latency_info().FindLatency( |
4096 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component)); | 4096 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component)); |
4097 EXPECT_EQ(time_ui, component.event_time); | 4097 EXPECT_EQ(time_ui, component.event_time); |
4098 | 4098 |
4099 ASSERT_TRUE(delegate->latency_info().FindLatency( | 4099 ASSERT_TRUE(delegate->latency_info().FindLatency( |
4100 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, &component)); | 4100 ui::INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 0, &component)); |
4101 EXPECT_EQ(time_acked, component.event_time); | 4101 EXPECT_EQ(time_acked, component.event_time); |
4102 | 4102 |
4103 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); | 4103 delegate->WaitUntilReceivedGesture(ui::ET_GESTURE_SHOW_PRESS); |
4104 EXPECT_TRUE(delegate->show_press()); | 4104 EXPECT_TRUE(delegate->show_press()); |
4105 EXPECT_EQ(0U, delegate->latency_info().latency_components.size()); | 4105 EXPECT_EQ(0U, delegate->latency_info().latency_components.size()); |
4106 } | 4106 } |
4107 | 4107 |
4108 // A delegate that deletes a window on long press. | 4108 // A delegate that deletes a window on long press. |
4109 class GestureEventDeleteWindowOnLongPress : public GestureEventConsumeDelegate { | 4109 class GestureEventDeleteWindowOnLongPress : public GestureEventConsumeDelegate { |
4110 public: | 4110 public: |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4311 ui::TouchEvent move3( | 4311 ui::TouchEvent move3( |
4312 ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now()); | 4312 ui::ET_TOUCH_MOVED, gfx::Point(65, 202), kTouchId1, tes.Now()); |
4313 DispatchEventUsingWindowDispatcher(&move3); | 4313 DispatchEventUsingWindowDispatcher(&move3); |
4314 | 4314 |
4315 delegate->ReceivedAck(); | 4315 delegate->ReceivedAck(); |
4316 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); | 4316 EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE); |
4317 } | 4317 } |
4318 | 4318 |
4319 } // namespace test | 4319 } // namespace test |
4320 } // namespace aura | 4320 } // namespace aura |
OLD | NEW |