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

Side by Side Diff: chrome/browser/ui/views/web_dialog_view_browsertest.cc

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 114 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
115 115
116 gfx::Rect set_bounds = bounds; 116 gfx::Rect set_bounds = bounds;
117 gfx::Rect actual_bounds, rwhv_bounds; 117 gfx::Rect actual_bounds, rwhv_bounds;
118 118
119 // Bigger than the default in both dimensions. 119 // Bigger than the default in both dimensions.
120 set_bounds.set_width(400); 120 set_bounds.set_width(400);
121 set_bounds.set_height(300); 121 set_bounds.set_height(300);
122 122
123 view->MoveContents(web_contents, set_bounds); 123 view->MoveContents(web_contents, set_bounds);
124 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 124 content::RunMessageLoop(); // TestWebDialogView will quit.
125 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 125 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
126 EXPECT_EQ(set_bounds, actual_bounds); 126 EXPECT_EQ(set_bounds, actual_bounds);
127 127
128 rwhv_bounds = 128 rwhv_bounds =
129 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 129 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
130 EXPECT_LT(0, rwhv_bounds.width()); 130 EXPECT_LT(0, rwhv_bounds.width());
131 EXPECT_LT(0, rwhv_bounds.height()); 131 EXPECT_LT(0, rwhv_bounds.height());
132 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 132 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
133 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 133 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
134 134
135 // Larger in one dimension and smaller in the other. 135 // Larger in one dimension and smaller in the other.
136 set_bounds.set_width(550); 136 set_bounds.set_width(550);
137 set_bounds.set_height(250); 137 set_bounds.set_height(250);
138 138
139 view->MoveContents(web_contents, set_bounds); 139 view->MoveContents(web_contents, set_bounds);
140 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 140 content::RunMessageLoop(); // TestWebDialogView will quit.
141 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 141 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
142 EXPECT_EQ(set_bounds, actual_bounds); 142 EXPECT_EQ(set_bounds, actual_bounds);
143 143
144 rwhv_bounds = 144 rwhv_bounds =
145 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 145 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
146 EXPECT_LT(0, rwhv_bounds.width()); 146 EXPECT_LT(0, rwhv_bounds.width());
147 EXPECT_LT(0, rwhv_bounds.height()); 147 EXPECT_LT(0, rwhv_bounds.height());
148 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 148 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
149 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 149 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
150 150
151 // Get very small. 151 // Get very small.
152 gfx::Size min_size = view->GetWidget()->GetMinimumSize(); 152 gfx::Size min_size = view->GetWidget()->GetMinimumSize();
153 set_bounds.set_size(min_size); 153 set_bounds.set_size(min_size);
154 154
155 view->MoveContents(web_contents, set_bounds); 155 view->MoveContents(web_contents, set_bounds);
156 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 156 content::RunMessageLoop(); // TestWebDialogView will quit.
157 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 157 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
158 EXPECT_EQ(set_bounds, actual_bounds); 158 EXPECT_EQ(set_bounds, actual_bounds);
159 159
160 rwhv_bounds = 160 rwhv_bounds =
161 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 161 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
162 EXPECT_LT(0, rwhv_bounds.width()); 162 EXPECT_LT(0, rwhv_bounds.width());
163 EXPECT_LT(0, rwhv_bounds.height()); 163 EXPECT_LT(0, rwhv_bounds.height());
164 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 164 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
165 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 165 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
166 166
167 // Check to make sure we can't get to 0x0 167 // Check to make sure we can't get to 0x0
168 set_bounds.set_width(0); 168 set_bounds.set_width(0);
169 set_bounds.set_height(0); 169 set_bounds.set_height(0);
170 170
171 view->MoveContents(web_contents, set_bounds); 171 view->MoveContents(web_contents, set_bounds);
172 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 172 content::RunMessageLoop(); // TestWebDialogView will quit.
173 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen(); 173 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
174 EXPECT_LT(0, actual_bounds.width()); 174 EXPECT_LT(0, actual_bounds.width());
175 EXPECT_LT(0, actual_bounds.height()); 175 EXPECT_LT(0, actual_bounds.height());
176 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698