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

Side by Side Diff: content/public/test/render_widget_test.cc

Issue 16048003: Fix race between DPI and window size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove semicolon Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/renderer/render_view_impl.h » ('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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 151 void RenderWidgetTest::TestOnResize() {
152 RenderWidget* widget = static_cast<RenderViewImpl*>(view_); 152 RenderWidget* widget = static_cast<RenderViewImpl*>(view_);
153 153
154 // The initial bounds is empty, so setting it to the same thing should do 154 // The initial bounds is empty, so setting it to the same thing should do
155 // nothing. 155 // nothing.
156 widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false); 156 ViewMsg_Resize_Params resize_params;
157 resize_params.screen_info = WebKit::WebScreenInfo();
158 resize_params.new_size = gfx::Size();
159 resize_params.physical_backing_size = gfx::Size();
160 resize_params.overdraw_bottom_height = 0.f;
161 resize_params.resizer_rect = gfx::Rect();
162 resize_params.is_fullscreen = false;
163 widget->OnResize(resize_params);
157 EXPECT_FALSE(widget->next_paint_is_resize_ack()); 164 EXPECT_FALSE(widget->next_paint_is_resize_ack());
158 165
159 // Setting empty physical backing size should not send the ack. 166 // Setting empty physical backing size should not send the ack.
160 widget->OnResize(gfx::Size(10, 10), gfx::Size(), 0, gfx::Rect(), false); 167 resize_params.new_size = gfx::Size(10, 10);
168 widget->OnResize(resize_params);
161 EXPECT_FALSE(widget->next_paint_is_resize_ack()); 169 EXPECT_FALSE(widget->next_paint_is_resize_ack());
162 170
163 // Setting the bounds to a "real" rect should send the ack. 171 // Setting the bounds to a "real" rect should send the ack.
164 render_thread_->sink().ClearMessages(); 172 render_thread_->sink().ClearMessages();
165 gfx::Size size(100, 100); 173 gfx::Size size(100, 100);
166 widget->OnResize(size, size, 0, gfx::Rect(), false); 174 resize_params.new_size = size;
175 resize_params.physical_backing_size = size;
176 widget->OnResize(resize_params);
167 EXPECT_TRUE(widget->next_paint_is_resize_ack()); 177 EXPECT_TRUE(widget->next_paint_is_resize_ack());
168 widget->DoDeferredUpdate(); 178 widget->DoDeferredUpdate();
169 ProcessPendingMessages(); 179 ProcessPendingMessages();
170 180
171 const ViewHostMsg_UpdateRect* msg = 181 const ViewHostMsg_UpdateRect* msg =
172 static_cast<const ViewHostMsg_UpdateRect*>( 182 static_cast<const ViewHostMsg_UpdateRect*>(
173 render_thread_->sink().GetUniqueMessageMatching( 183 render_thread_->sink().GetUniqueMessageMatching(
174 ViewHostMsg_UpdateRect::ID)); 184 ViewHostMsg_UpdateRect::ID));
175 ASSERT_TRUE(msg); 185 ASSERT_TRUE(msg);
176 ViewHostMsg_UpdateRect::Schema::Param params; 186 ViewHostMsg_UpdateRect::Schema::Param update_rect_params;
177 EXPECT_TRUE(ViewHostMsg_UpdateRect::Read(msg, &params)); 187 EXPECT_TRUE(ViewHostMsg_UpdateRect::Read(msg, &update_rect_params));
178 EXPECT_TRUE(ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.a.flags)); 188 EXPECT_TRUE(ViewHostMsg_UpdateRect_Flags::is_resize_ack(
179 EXPECT_EQ(size, params.a.view_size); 189 update_rect_params.a.flags));
190 EXPECT_EQ(size,
191 update_rect_params.a.view_size);
180 render_thread_->sink().ClearMessages(); 192 render_thread_->sink().ClearMessages();
181 193
182 // Setting the same size again should not send the ack. 194 // Setting the same size again should not send the ack.
183 widget->OnResize(size, size, 0, gfx::Rect(), false); 195 widget->OnResize(resize_params);
184 EXPECT_FALSE(widget->next_paint_is_resize_ack()); 196 EXPECT_FALSE(widget->next_paint_is_resize_ack());
185 197
186 // Resetting the rect to empty should not send the ack. 198 // Resetting the rect to empty should not send the ack.
187 widget->OnResize(gfx::Size(), gfx::Size(), 0, gfx::Rect(), false); 199 resize_params.new_size = gfx::Size();
200 resize_params.physical_backing_size = gfx::Size();
201 widget->OnResize(resize_params);
188 EXPECT_FALSE(widget->next_paint_is_resize_ack()); 202 EXPECT_FALSE(widget->next_paint_is_resize_ack());
189 } 203 }
190 204
191 } // namespace content 205 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.cc ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698