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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 | 452 |
453 virtual void ConfigureView(TestView* view) { | 453 virtual void ConfigureView(TestView* view) { |
454 } | 454 } |
455 | 455 |
456 int64 GetLatencyComponentId() { | 456 int64 GetLatencyComponentId() { |
457 return host_->GetLatencyComponentId(); | 457 return host_->GetLatencyComponentId(); |
458 } | 458 } |
459 | 459 |
460 void SendInputEventACK(WebInputEvent::Type type, | 460 void SendInputEventACK(WebInputEvent::Type type, |
461 InputEventAckState ack_result) { | 461 InputEventAckState ack_result) { |
462 InputHostMsg_HandleInputEvent_ACK_Params ack; | 462 InputEventAck ack(type, ack_result); |
jdduke (slow)
2015/05/07 21:11:15
Maybe DCHECK(!WebInputEventTraits::isTouchEventTyp
lanwei
2015/05/08 19:31:26
Done.
| |
463 ack.type = type; | |
464 ack.state = ack_result; | |
465 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); | 463 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
466 } | 464 } |
467 | 465 |
466 void SendTouchEventACK(WebInputEvent::Type type, | |
jdduke (slow)
2015/05/07 21:11:15
This is used just once, I'd rather we either just
lanwei
2015/05/08 19:31:25
Done.
| |
467 InputEventAckState ack_result) { | |
468 InputEventAck ack(type, ack_result); | |
469 size_t count = process_->sink().message_count(); | |
470 LOG(ERROR) << " count " << count; | |
jdduke (slow)
2015/05/07 21:11:15
Not sure we need this log?
lanwei
2015/05/08 19:31:26
Forgot to delete :)
| |
471 for (size_t i = 0; i < count; ++i) { | |
472 const WebInputEvent* input_event = | |
473 GetInputEventFromMessage(*process_->sink().GetMessageAt(i)); | |
474 ack.unique_touch_event_id = | |
475 WebInputEventTraits::GetUniqueTouchEventId(*input_event); | |
476 } | |
477 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); | |
478 } | |
479 | |
468 double GetNextSimulatedEventTimeSeconds() { | 480 double GetNextSimulatedEventTimeSeconds() { |
469 last_simulated_event_time_seconds_ += simulated_event_time_delta_seconds_; | 481 last_simulated_event_time_seconds_ += simulated_event_time_delta_seconds_; |
470 return last_simulated_event_time_seconds_; | 482 return last_simulated_event_time_seconds_; |
471 } | 483 } |
472 | 484 |
473 void SimulateKeyboardEvent(WebInputEvent::Type type) { | 485 void SimulateKeyboardEvent(WebInputEvent::Type type) { |
474 SimulateKeyboardEvent(type, 0); | 486 SimulateKeyboardEvent(type, 0); |
475 } | 487 } |
476 | 488 |
477 void SimulateKeyboardEvent(WebInputEvent::Type type, int modifiers) { | 489 void SimulateKeyboardEvent(WebInputEvent::Type type, int modifiers) { |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1429 blink::WebGestureDeviceTouchscreen, | 1441 blink::WebGestureDeviceTouchscreen, |
1430 ui::LatencyInfo()); | 1442 ui::LatencyInfo()); |
1431 CheckLatencyInfoComponentInMessage( | 1443 CheckLatencyInfoComponentInMessage( |
1432 process_, GetLatencyComponentId(), WebInputEvent::GestureScrollUpdate); | 1444 process_, GetLatencyComponentId(), WebInputEvent::GestureScrollUpdate); |
1433 SendInputEventACK(WebInputEvent::GestureScrollUpdate, | 1445 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
1434 INPUT_EVENT_ACK_STATE_CONSUMED); | 1446 INPUT_EVENT_ACK_STATE_CONSUMED); |
1435 | 1447 |
1436 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). | 1448 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). |
1437 PressTouchPoint(0, 1); | 1449 PressTouchPoint(0, 1); |
1438 SendTouchEvent(); | 1450 SendTouchEvent(); |
1451 SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); | |
1439 CheckLatencyInfoComponentInMessage( | 1452 CheckLatencyInfoComponentInMessage( |
1440 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); | 1453 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); |
1441 SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); | |
1442 } | 1454 } |
1443 | 1455 |
1444 TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) { | 1456 TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) { |
1445 // RendererExited will delete the view. | 1457 // RendererExited will delete the view. |
1446 host_->SetView(new TestView(host_.get())); | 1458 host_->SetView(new TestView(host_.get())); |
1447 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); | 1459 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); |
1448 | 1460 |
1449 // Make sure the input router is in a fresh state. | 1461 // Make sure the input router is in a fresh state. |
1450 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1462 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
1451 } | 1463 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1493 // Having an initial size set means that the size information had been sent | 1505 // Having an initial size set means that the size information had been sent |
1494 // with the reqiest to new up the RenderView and so subsequent WasResized | 1506 // with the reqiest to new up the RenderView and so subsequent WasResized |
1495 // calls should not result in new IPC (unless the size has actually changed). | 1507 // calls should not result in new IPC (unless the size has actually changed). |
1496 host_->WasResized(); | 1508 host_->WasResized(); |
1497 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 1509 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
1498 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); | 1510 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); |
1499 EXPECT_TRUE(host_->resize_ack_pending_); | 1511 EXPECT_TRUE(host_->resize_ack_pending_); |
1500 } | 1512 } |
1501 | 1513 |
1502 } // namespace content | 1514 } // namespace content |
OLD | NEW |