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

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

Issue 888693004: Make RenderWidgetHostViewAuraTest.Resize robust to different IPC orderings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 // Frame isn't desired size, so early ack. 1524 // Frame isn't desired size, so early ack.
1525 EXPECT_EQ(1u, sink_->message_count()); 1525 EXPECT_EQ(1u, sink_->message_count());
1526 } 1526 }
1527 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 1527 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
1528 1528
1529 // Wait for commit, then we should unlock the compositor and send a Resize 1529 // Wait for commit, then we should unlock the compositor and send a Resize
1530 // message (and a frame ack) 1530 // message (and a frame ack)
1531 ui::DrawWaiterForTest::WaitForCommit( 1531 ui::DrawWaiterForTest::WaitForCommit(
1532 root_window->GetHost()->compositor()); 1532 root_window->GetHost()->compositor());
1533 1533
1534 // On some platforms, the call to view_->Show() causes a posted task to call 1534 bool has_resize = false;
1535 // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow, which 1535 for (uint32 i = 0; i < sink_->message_count(); ++i) {
1536 // the above WaitForCommit may cause to be picked up. Be robust to this extra 1536 const IPC::Message* msg = sink_->GetMessageAt(i);
1537 // IPC coming in. 1537 switch (msg->type()) {
1538 bool has_extra_ipc = (sink_->message_count() == 3); 1538 case InputMsg_HandleInputEvent::ID: {
1539 if (has_extra_ipc) { 1539 // On some platforms, the call to view_->Show() causes a posted task to
1540 const IPC::Message* msg = sink_->GetMessageAt(0); 1540 // call
1541 EXPECT_EQ(InputMsg_HandleInputEvent::ID, msg->type()); 1541 // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow,
1542 InputMsg_HandleInputEvent::Param params; 1542 // which the above WaitForCommit may cause to be picked up. Be robust
1543 InputMsg_HandleInputEvent::Read(msg, &params); 1543 // to this extra IPC coming in.
1544 const blink::WebInputEvent* event = get<0>(params); 1544 InputMsg_HandleInputEvent::Param params;
1545 EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type); 1545 InputMsg_HandleInputEvent::Read(msg, &params);
1546 const blink::WebInputEvent* event = get<0>(params);
1547 EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type);
1548 break;
1549 }
1550 case ViewMsg_SwapCompositorFrameAck::ID:
1551 break;
1552 case ViewMsg_Resize::ID: {
1553 EXPECT_FALSE(has_resize);
1554 ViewMsg_Resize::Param params;
1555 ViewMsg_Resize::Read(msg, &params);
1556 EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString());
1557 has_resize = true;
1558 break;
1559 }
1560 default:
1561 EXPECT_TRUE(false);
piman 2015/01/30 03:57:54 nit: ADD_FAILURE() You can even add a message.
1562 break;
1563 }
1546 } 1564 }
1547 else { 1565 EXPECT_TRUE(has_resize);
1548 EXPECT_EQ(2u, sink_->message_count());
1549 }
1550 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID,
1551 sink_->GetMessageAt(has_extra_ipc ? 1 : 0)->type());
1552 {
1553 const IPC::Message* msg = sink_->GetMessageAt(has_extra_ipc ? 2 : 1);
1554 EXPECT_EQ(ViewMsg_Resize::ID, msg->type());
1555 ViewMsg_Resize::Param params;
1556 ViewMsg_Resize::Read(msg, &params);
1557 EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString());
1558 }
1559 update_params.view_size = size3; 1566 update_params.view_size = size3;
1560 widget_host_->OnMessageReceived( 1567 widget_host_->OnMessageReceived(
1561 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); 1568 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params));
1562 sink_->ClearMessages(); 1569 sink_->ClearMessages();
1563 } 1570 }
1564 1571
1565 // Skipped frames should not drop their damage. 1572 // Skipped frames should not drop their damage.
1566 TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) { 1573 TEST_F(RenderWidgetHostViewAuraTest, SkippedDelegatedFrames) {
1567 gfx::Rect view_rect(100, 100); 1574 gfx::Rect view_rect(100, 100);
1568 gfx::Size frame_size = view_rect.size(); 1575 gfx::Size frame_size = view_rect.size();
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 view_->OnScrollEvent(&scroll); 3159 view_->OnScrollEvent(&scroll);
3153 3160
3154 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); 3161 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
3155 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); 3162 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event);
3156 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated 3163 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated
3157 // from scroll event. 3164 // from scroll event.
3158 EXPECT_TRUE(wheel_event->canScroll); 3165 EXPECT_TRUE(wheel_event->canScroll);
3159 } 3166 }
3160 3167
3161 } // namespace content 3168 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698