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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 517a59dd64fc4afd2433566b66ea7beb38f1511b..e4daf96ba9d328b21fc3408c4040460bff5523f9 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -1531,31 +1531,38 @@ TEST_F(RenderWidgetHostViewAuraTest, Resize) {
ui::DrawWaiterForTest::WaitForCommit(
root_window->GetHost()->compositor());
- // On some platforms, the call to view_->Show() causes a posted task to call
- // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow, which
- // the above WaitForCommit may cause to be picked up. Be robust to this extra
- // IPC coming in.
- bool has_extra_ipc = (sink_->message_count() == 3);
- if (has_extra_ipc) {
- const IPC::Message* msg = sink_->GetMessageAt(0);
- EXPECT_EQ(InputMsg_HandleInputEvent::ID, msg->type());
- InputMsg_HandleInputEvent::Param params;
- InputMsg_HandleInputEvent::Read(msg, &params);
- const blink::WebInputEvent* event = get<0>(params);
- EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type);
- }
- else {
- EXPECT_EQ(2u, sink_->message_count());
- }
- EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID,
- sink_->GetMessageAt(has_extra_ipc ? 1 : 0)->type());
- {
- const IPC::Message* msg = sink_->GetMessageAt(has_extra_ipc ? 2 : 1);
- EXPECT_EQ(ViewMsg_Resize::ID, msg->type());
- ViewMsg_Resize::Param params;
- ViewMsg_Resize::Read(msg, &params);
- EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString());
+ bool has_resize = false;
+ for (uint32 i = 0; i < sink_->message_count(); ++i) {
+ const IPC::Message* msg = sink_->GetMessageAt(i);
+ switch (msg->type()) {
+ case InputMsg_HandleInputEvent::ID: {
+ // On some platforms, the call to view_->Show() causes a posted task to
+ // call
+ // ui::WindowEventDispatcher::SynthesizeMouseMoveAfterChangeToWindow,
+ // which the above WaitForCommit may cause to be picked up. Be robust
+ // to this extra IPC coming in.
+ InputMsg_HandleInputEvent::Param params;
+ InputMsg_HandleInputEvent::Read(msg, &params);
+ const blink::WebInputEvent* event = get<0>(params);
+ EXPECT_EQ(blink::WebInputEvent::MouseMove, event->type);
+ break;
+ }
+ case ViewMsg_SwapCompositorFrameAck::ID:
+ break;
+ case ViewMsg_Resize::ID: {
+ EXPECT_FALSE(has_resize);
+ ViewMsg_Resize::Param params;
+ ViewMsg_Resize::Read(msg, &params);
+ EXPECT_EQ(size3.ToString(), get<0>(params).new_size.ToString());
+ has_resize = true;
+ break;
+ }
+ default:
+ EXPECT_TRUE(false);
piman 2015/01/30 03:57:54 nit: ADD_FAILURE() You can even add a message.
+ break;
+ }
}
+ EXPECT_TRUE(has_resize);
update_params.view_size = size3;
widget_host_->OnMessageReceived(
ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params));
« 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