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

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 2482453002: Don't restart the hang renderer timeout on messages ack'd from the compositor thread. (Closed)
Patch Set: Fix mac build Created 4 years, 1 month 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 (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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <tuple> 9 #include <tuple>
10 10
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 virtual void ConfigureView(TestView* view) { 523 virtual void ConfigureView(TestView* view) {
524 } 524 }
525 525
526 int64_t GetLatencyComponentId() { return host_->GetLatencyComponentId(); } 526 int64_t GetLatencyComponentId() { return host_->GetLatencyComponentId(); }
527 527
528 void SendInputEventACK(WebInputEvent::Type type, 528 void SendInputEventACK(WebInputEvent::Type type,
529 InputEventAckState ack_result) { 529 InputEventAckState ack_result) {
530 DCHECK(!WebInputEvent::isTouchEventType(type)); 530 DCHECK(!WebInputEvent::isTouchEventType(type));
531 InputEventAck ack(type, ack_result); 531 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD, type, ack_result);
532 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); 532 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
533 } 533 }
534 534
535 double GetNextSimulatedEventTimeSeconds() { 535 double GetNextSimulatedEventTimeSeconds() {
536 last_simulated_event_time_seconds_ += simulated_event_time_delta_seconds_; 536 last_simulated_event_time_seconds_ += simulated_event_time_delta_seconds_;
537 return last_simulated_event_time_seconds_; 537 return last_simulated_event_time_seconds_;
538 } 538 }
539 539
540 void SimulateKeyboardEvent(WebInputEvent::Type type) { 540 void SimulateKeyboardEvent(WebInputEvent::Type type) {
541 SimulateKeyboardEvent(type, 0); 541 SimulateKeyboardEvent(type, 0);
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 blink::WebGestureDeviceTouchscreen, 1621 blink::WebGestureDeviceTouchscreen,
1622 ui::LatencyInfo()); 1622 ui::LatencyInfo());
1623 CheckLatencyInfoComponentInMessage( 1623 CheckLatencyInfoComponentInMessage(
1624 process_, GetLatencyComponentId(), WebInputEvent::GestureScrollUpdate); 1624 process_, GetLatencyComponentId(), WebInputEvent::GestureScrollUpdate);
1625 SendInputEventACK(WebInputEvent::GestureScrollUpdate, 1625 SendInputEventACK(WebInputEvent::GestureScrollUpdate,
1626 INPUT_EVENT_ACK_STATE_CONSUMED); 1626 INPUT_EVENT_ACK_STATE_CONSUMED);
1627 1627
1628 // Tests RWHI::ForwardTouchEventWithLatencyInfo(). 1628 // Tests RWHI::ForwardTouchEventWithLatencyInfo().
1629 PressTouchPoint(0, 1); 1629 PressTouchPoint(0, 1);
1630 uint32_t touch_event_id = SendTouchEvent(); 1630 uint32_t touch_event_id = SendTouchEvent();
1631 InputEventAck ack(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, 1631 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD,
1632 WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED,
1632 touch_event_id); 1633 touch_event_id);
1633 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); 1634 host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
1634 CheckLatencyInfoComponentInMessage( 1635 CheckLatencyInfoComponentInMessage(
1635 process_, GetLatencyComponentId(), WebInputEvent::TouchStart); 1636 process_, GetLatencyComponentId(), WebInputEvent::TouchStart);
1636 } 1637 }
1637 1638
1638 TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) { 1639 TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) {
1639 // RendererExited will delete the view. 1640 // RendererExited will delete the view.
1640 host_->SetView(new TestView(host_.get())); 1641 host_->SetView(new TestView(host_.get()));
1641 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1); 1642 host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 ui::LatencyInfo()); 1708 ui::LatencyInfo());
1708 1709
1709 1710
1710 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). 1711 // Tests RWHI::ForwardWheelEventWithLatencyInfo().
1711 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); 1712 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo());
1712 1713
1713 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); 1714 ASSERT_FALSE(host_->input_router()->HasPendingEvents());
1714 } 1715 }
1715 1716
1716 } // namespace content 1717 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698