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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // RendererFrameManager singleton survives and and the MessageLoop gets 576 // RendererFrameManager singleton survives and and the MessageLoop gets
577 // destroyed. The correct fix would be to have base::ObserverListThreadSafe 577 // destroyed. The correct fix would be to have base::ObserverListThreadSafe
578 // look 578 // look
579 // up the proper message loop every time (see crbug.com/443824.) 579 // up the proper message loop every time (see crbug.com/443824.)
580 RendererFrameManager::GetInstance()->OnMemoryPressure(level); 580 RendererFrameManager::GetInstance()->OnMemoryPressure(level);
581 } 581 }
582 582
583 void SendInputEventACK(WebInputEvent::Type type, 583 void SendInputEventACK(WebInputEvent::Type type,
584 InputEventAckState ack_result) { 584 InputEventAckState ack_result) {
585 DCHECK(!WebInputEvent::isTouchEventType(type)); 585 DCHECK(!WebInputEvent::isTouchEventType(type));
586 InputEventAck ack(type, ack_result); 586 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD, type, ack_result);
587 InputHostMsg_HandleInputEvent_ACK response(0, ack); 587 InputHostMsg_HandleInputEvent_ACK response(0, ack);
588 widget_host_->OnMessageReceived(response); 588 widget_host_->OnMessageReceived(response);
589 } 589 }
590 590
591 void SendTouchEventACK(WebInputEvent::Type type, 591 void SendTouchEventACK(WebInputEvent::Type type,
592 InputEventAckState ack_result, 592 InputEventAckState ack_result,
593 uint32_t event_id) { 593 uint32_t event_id) {
594 DCHECK(WebInputEvent::isTouchEventType(type)); 594 DCHECK(WebInputEvent::isTouchEventType(type));
595 InputEventAck ack(type, ack_result, event_id); 595 InputEventAck ack(InputEventAckSource::COMPOSITOR_THREAD, type, ack_result,
596 event_id);
596 InputHostMsg_HandleInputEvent_ACK response(0, ack); 597 InputHostMsg_HandleInputEvent_ACK response(0, ack);
597 widget_host_->OnMessageReceived(response); 598 widget_host_->OnMessageReceived(response);
598 } 599 }
599 600
600 size_t GetSentMessageCountAndResetSink() { 601 size_t GetSentMessageCountAndResetSink() {
601 size_t count = sink_->message_count(); 602 size_t count = sink_->message_count();
602 sink_->ClearMessages(); 603 sink_->ClearMessages();
603 return count; 604 return count;
604 } 605 }
605 606
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 1336
1336 // Now start a touch event, and remove the event-handlers before the release. 1337 // Now start a touch event, and remove the event-handlers before the release.
1337 view_->OnTouchEvent(&press); 1338 view_->OnTouchEvent(&press);
1338 EXPECT_TRUE(press.synchronous_handling_disabled()); 1339 EXPECT_TRUE(press.synchronous_handling_disabled());
1339 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); 1340 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction());
1340 EXPECT_EQ(1U, pointer_state().GetPointerCount()); 1341 EXPECT_EQ(1U, pointer_state().GetPointerCount());
1341 1342
1342 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); 1343 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false));
1343 1344
1344 // Ack'ing the outstanding event should flush the pending touch queue. 1345 // Ack'ing the outstanding event should flush the pending touch queue.
1345 InputEventAck ack(blink::WebInputEvent::TouchStart, 1346 InputEventAck ack(
1346 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, 1347 InputEventAckSource::COMPOSITOR_THREAD, blink::WebInputEvent::TouchStart,
1347 press.unique_event_id()); 1348 INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, press.unique_event_id());
1348 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); 1349 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
1349 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); 1350 EXPECT_EQ(0U, GetSentMessageCountAndResetSink());
1350 1351
1351 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, 1352 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0,
1352 base::TimeTicks::Now()); 1353 base::TimeTicks::Now());
1353 view_->OnTouchEvent(&move2); 1354 view_->OnTouchEvent(&move2);
1354 EXPECT_TRUE(press.synchronous_handling_disabled()); 1355 EXPECT_TRUE(press.synchronous_handling_disabled());
1355 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction()); 1356 EXPECT_EQ(ui::MotionEvent::ACTION_MOVE, pointer_state().GetAction());
1356 EXPECT_EQ(1U, pointer_state().GetPointerCount()); 1357 EXPECT_EQ(1U, pointer_state().GetPointerCount());
1357 1358
(...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 4690
4690 // Retrieve the selected text from clipboard and verify it is as expected. 4691 // Retrieve the selected text from clipboard and verify it is as expected.
4691 base::string16 result_text; 4692 base::string16 result_text;
4692 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4693 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4693 EXPECT_EQ(expected_text, result_text); 4694 EXPECT_EQ(expected_text, result_text);
4694 } 4695 }
4695 } 4696 }
4696 #endif 4697 #endif
4697 4698
4698 } // namespace content 4699 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698