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

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

Issue 10795013: Rename bounds accessors to be intuitive and consistent (Closed) Base URL: svn://svn.chromium.org/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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 new TestWebDialogView(browser()->profile(), delegate); 102 new TestWebDialogView(browser()->profile(), delegate);
103 WebContents* web_contents = chrome::GetActiveWebContents(browser()); 103 WebContents* web_contents = chrome::GetActiveWebContents(browser());
104 ASSERT_TRUE(web_contents != NULL); 104 ASSERT_TRUE(web_contents != NULL);
105 views::Widget::CreateWindowWithParent( 105 views::Widget::CreateWindowWithParent(
106 view, web_contents->GetView()->GetTopLevelNativeWindow()); 106 view, web_contents->GetView()->GetTopLevelNativeWindow());
107 view->GetWidget()->Show(); 107 view->GetWidget()->Show();
108 108
109 // TestWebDialogView should quit current message loop on size change. 109 // TestWebDialogView should quit current message loop on size change.
110 view->set_should_quit_on_size_change(true); 110 view->set_should_quit_on_size_change(true);
111 111
112 gfx::Rect bounds = view->GetWidget()->GetClientAreaScreenBounds(); 112 gfx::Rect bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
113 113
114 gfx::Rect set_bounds = bounds; 114 gfx::Rect set_bounds = bounds;
115 gfx::Rect actual_bounds, rwhv_bounds; 115 gfx::Rect actual_bounds, rwhv_bounds;
116 116
117 // Bigger than the default in both dimensions. 117 // Bigger than the default in both dimensions.
118 set_bounds.set_width(400); 118 set_bounds.set_width(400);
119 set_bounds.set_height(300); 119 set_bounds.set_height(300);
120 120
121 view->MoveContents(web_contents, set_bounds); 121 view->MoveContents(web_contents, set_bounds);
122 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 122 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit.
123 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); 123 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
124 EXPECT_EQ(set_bounds, actual_bounds); 124 EXPECT_EQ(set_bounds, actual_bounds);
125 125
126 rwhv_bounds = 126 rwhv_bounds =
127 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 127 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
128 EXPECT_LT(0, rwhv_bounds.width()); 128 EXPECT_LT(0, rwhv_bounds.width());
129 EXPECT_LT(0, rwhv_bounds.height()); 129 EXPECT_LT(0, rwhv_bounds.height());
130 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 130 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
131 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 131 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
132 132
133 // Larger in one dimension and smaller in the other. 133 // Larger in one dimension and smaller in the other.
134 set_bounds.set_width(550); 134 set_bounds.set_width(550);
135 set_bounds.set_height(250); 135 set_bounds.set_height(250);
136 136
137 view->MoveContents(web_contents, set_bounds); 137 view->MoveContents(web_contents, set_bounds);
138 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 138 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit.
139 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); 139 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
140 EXPECT_EQ(set_bounds, actual_bounds); 140 EXPECT_EQ(set_bounds, actual_bounds);
141 141
142 rwhv_bounds = 142 rwhv_bounds =
143 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 143 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
144 EXPECT_LT(0, rwhv_bounds.width()); 144 EXPECT_LT(0, rwhv_bounds.width());
145 EXPECT_LT(0, rwhv_bounds.height()); 145 EXPECT_LT(0, rwhv_bounds.height());
146 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 146 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
147 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 147 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
148 148
149 // Get very small. 149 // Get very small.
150 gfx::Size min_size = view->GetWidget()->GetMinimumSize(); 150 gfx::Size min_size = view->GetWidget()->GetMinimumSize();
151 set_bounds.set_size(min_size); 151 set_bounds.set_size(min_size);
152 152
153 view->MoveContents(web_contents, set_bounds); 153 view->MoveContents(web_contents, set_bounds);
154 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 154 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit.
155 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); 155 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
156 EXPECT_EQ(set_bounds, actual_bounds); 156 EXPECT_EQ(set_bounds, actual_bounds);
157 157
158 rwhv_bounds = 158 rwhv_bounds =
159 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds(); 159 view->web_contents()->GetRenderWidgetHostView()->GetViewBounds();
160 EXPECT_LT(0, rwhv_bounds.width()); 160 EXPECT_LT(0, rwhv_bounds.width());
161 EXPECT_LT(0, rwhv_bounds.height()); 161 EXPECT_LT(0, rwhv_bounds.height());
162 EXPECT_GE(set_bounds.width(), rwhv_bounds.width()); 162 EXPECT_GE(set_bounds.width(), rwhv_bounds.width());
163 EXPECT_GE(set_bounds.height(), rwhv_bounds.height()); 163 EXPECT_GE(set_bounds.height(), rwhv_bounds.height());
164 164
165 // Check to make sure we can't get to 0x0 165 // Check to make sure we can't get to 0x0
166 set_bounds.set_width(0); 166 set_bounds.set_width(0);
167 set_bounds.set_height(0); 167 set_bounds.set_height(0);
168 168
169 view->MoveContents(web_contents, set_bounds); 169 view->MoveContents(web_contents, set_bounds);
170 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit. 170 ui_test_utils::RunMessageLoop(); // TestWebDialogView will quit.
171 actual_bounds = view->GetWidget()->GetClientAreaScreenBounds(); 171 actual_bounds = view->GetWidget()->GetClientAreaBoundsInScreen();
172 EXPECT_LT(0, actual_bounds.width()); 172 EXPECT_LT(0, actual_bounds.width());
173 EXPECT_LT(0, actual_bounds.height()); 173 EXPECT_LT(0, actual_bounds.height());
174 } 174 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | chrome/browser/ui/window_sizer/window_sizer_ash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698