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

Unified Diff: content/public/test/render_widget_test.cc

Issue 14779010: Don't expect ack for ViewMsg_OnResize if backing size is empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep short_circuit_size_update condition Created 7 years, 7 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 | « content/public/test/render_widget_test.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/render_widget_test.cc
diff --git a/content/public/test/render_widget_test.cc b/content/public/test/render_widget_test.cc
index 8d8e897d6e98a4a48df5ecb3178e54fc63ae237f..9e19bc333fb205c0f16a06024ac937f7c210155f 100644
--- a/content/public/test/render_widget_test.cc
+++ b/content/public/test/render_widget_test.cc
@@ -148,4 +148,44 @@ void RenderWidgetTest::OutputBitmapToFile(const SkBitmap& bitmap,
bitmap_data->size()));
}
+void RenderWidgetTest::TestOnResize() {
+ RenderWidget* widget = static_cast<RenderViewImpl*>(view_);
+
+ // The initial bounds is empty, so setting it to the same thing should do
+ // nothing.
+ widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false);
+ EXPECT_FALSE(widget->next_paint_is_resize_ack());
+
+ // Setting empty physical backing size should not send the ack.
+ widget->OnResize(gfx::Size(10, 10), gfx::Size(), 0, gfx::Rect(), false);
+ EXPECT_FALSE(widget->next_paint_is_resize_ack());
+
+ // Setting the bounds to a "real" rect should send the ack.
+ render_thread_->sink().ClearMessages();
+ gfx::Size size(100, 100);
+ widget->OnResize(size, size, 0, gfx::Rect(), false);
+ EXPECT_TRUE(widget->next_paint_is_resize_ack());
+ widget->DoDeferredUpdate();
+ ProcessPendingMessages();
+
+ const ViewHostMsg_UpdateRect* msg =
+ static_cast<const ViewHostMsg_UpdateRect*>(
+ render_thread_->sink().GetUniqueMessageMatching(
+ ViewHostMsg_UpdateRect::ID));
+ ASSERT_TRUE(msg);
+ ViewHostMsg_UpdateRect::Schema::Param params;
+ EXPECT_TRUE(ViewHostMsg_UpdateRect::Read(msg, &params));
+ EXPECT_TRUE(ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.a.flags));
+ EXPECT_EQ(size, params.a.view_size);
+ render_thread_->sink().ClearMessages();
+
+ // Setting the same size again should not send the ack.
+ widget->OnResize(size, size, 0, gfx::Rect(), false);
+ EXPECT_FALSE(widget->next_paint_is_resize_ack());
+
+ // Resetting the rect to empty should not send the ack.
+ widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false);
+ EXPECT_FALSE(widget->next_paint_is_resize_ack());
+}
+
} // namespace content
« no previous file with comments | « content/public/test/render_widget_test.h ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698