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

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.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: 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
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 84945b9da1bbdd3f44898b52f147232a10660f77..6376b99cf44fc3f8e113df2f98db284fe197cf9e 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -516,11 +516,27 @@ class TestView : public TestRenderWidgetHostView {
acked_event_ = touch;
++acked_event_count_;
}
+ virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE {
+ if (use_custom_physical_backing_size_)
+ return custom_physical_backing_size_;
+ return TestRenderWidgetHostView::GetPhysicalBackingSize();
+ }
+
+ void SetCustomPhysicalBackingSize(const gfx::Size& physical_backing_size) {
+ use_custom_physical_backing_size_ = true;
+ custom_physical_backing_size_ = physical_backing_size;
+ }
+
+ void ClearCustomPhysicalBackingSize() {
+ use_custom_physical_backing_size_ = false;
+ }
protected:
WebTouchEvent acked_event_;
int acked_event_count_;
gfx::Rect bounds_;
+ bool use_custom_physical_backing_size_;
+ gfx::Size custom_physical_backing_size_;
DISALLOW_COPY_AND_ASSIGN(TestView);
};
@@ -863,10 +879,20 @@ TEST_F(RenderWidgetHostTest, Resize) {
EXPECT_EQ(gfx::Size(), host_->in_flight_size_);
EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
- // Setting the bounds to a "real" rect should send out the notification.
+ // Setting the bounds to a "real" rect should send out the notification,
+ // but should not expect ack for empty physical backing size.
gfx::Rect original_size(0, 0, 100, 100);
process_->sink().ClearMessages();
view_->set_bounds(original_size);
+ view_->SetCustomPhysicalBackingSize(gfx::Size());
+ host_->WasResized();
+ EXPECT_FALSE(host_->resize_ack_pending_);
+ EXPECT_EQ(original_size.size(), host_->in_flight_size_);
+ EXPECT_TRUE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID));
+
+ // Setting the bounds to a "real" rect should send out the notification.
+ process_->sink().ClearMessages();
+ view_->ClearCustomPhysicalBackingSize();
host_->WasResized();
EXPECT_TRUE(host_->resize_ack_pending_);
EXPECT_EQ(original_size.size(), host_->in_flight_size_);

Powered by Google App Engine
This is Rietveld 408576698