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

Side by Side 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 unified diff | 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 »
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/public/test/render_widget_test.h" 5 #include "content/public/test/render_widget_test.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 bitmap.height(), 141 bitmap.height(),
142 static_cast<int>(bitmap.rowBytes()), 142 static_cast<int>(bitmap.rowBytes()),
143 90 /* quality */, 143 90 /* quality */,
144 &bitmap_data->data())); 144 &bitmap_data->data()));
145 ASSERT_LT(0, file_util::WriteFile( 145 ASSERT_LT(0, file_util::WriteFile(
146 file_path, 146 file_path,
147 reinterpret_cast<const char*>(bitmap_data->front()), 147 reinterpret_cast<const char*>(bitmap_data->front()),
148 bitmap_data->size())); 148 bitmap_data->size()));
149 } 149 }
150 150
151 void RenderWidgetTest::TestOnResize() {
152 RenderWidget* widget = static_cast<RenderViewImpl*>(view_);
153
154 // The initial bounds is empty, so setting it to the same thing should do
155 // nothing.
156 widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false);
157 EXPECT_FALSE(widget->next_paint_is_resize_ack());
158
159 // Setting empty physical backing size should not send the ack.
160 widget->OnResize(gfx::Size(10, 10), gfx::Size(), 0, gfx::Rect(), false);
161 EXPECT_FALSE(widget->next_paint_is_resize_ack());
162
163 // Setting the bounds to a "real" rect should send the ack.
164 render_thread_->sink().ClearMessages();
165 gfx::Size size(100, 100);
166 widget->OnResize(size, size, 0, gfx::Rect(), false);
167 EXPECT_TRUE(widget->next_paint_is_resize_ack());
168 widget->DoDeferredUpdate();
169 ProcessPendingMessages();
170
171 const ViewHostMsg_UpdateRect* msg =
172 static_cast<const ViewHostMsg_UpdateRect*>(
173 render_thread_->sink().GetUniqueMessageMatching(
174 ViewHostMsg_UpdateRect::ID));
175 ASSERT_TRUE(msg);
176 ViewHostMsg_UpdateRect::Schema::Param params;
177 EXPECT_TRUE(ViewHostMsg_UpdateRect::Read(msg, &params));
178 EXPECT_TRUE(ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.a.flags));
179 EXPECT_EQ(size, params.a.view_size);
180 render_thread_->sink().ClearMessages();
181
182 // Setting the same size again should not send the ack.
183 widget->OnResize(size, size, 0, gfx::Rect(), false);
184 EXPECT_FALSE(widget->next_paint_is_resize_ack());
185
186 // Resetting the rect to empty should not send the ack.
187 widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false);
188 EXPECT_FALSE(widget->next_paint_is_resize_ack());
189 }
190
151 } // namespace content 191 } // namespace content
OLDNEW
« 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