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

Side by Side Diff: chrome/browser/ui/panels/panel_resize_browsertest.cc

Issue 10260001: Remove panel size limit when user resizes it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 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 | 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 "chrome/browser/ui/panels/base_panel_browser_test.h" 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
6 #include "chrome/browser/ui/panels/detached_panel_strip.h" 6 #include "chrome/browser/ui/panels/detached_panel_strip.h"
7 #include "chrome/browser/ui/panels/panel.h" 7 #include "chrome/browser/ui/panels/panel.h"
8 #include "chrome/browser/ui/panels/panel_manager.h" 8 #include "chrome/browser/ui/panels/panel_manager.h"
9 #include "chrome/browser/ui/panels/panel_resize_controller.h" 9 #include "chrome/browser/ui/panels/panel_resize_controller.h"
10 10
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 panel::RESIZE_BOTTOM); 228 panel::RESIZE_BOTTOM);
229 mouse_location.Offset(-20, -500); 229 mouse_location.Offset(-20, -500);
230 panel_manager->ResizeByMouse(mouse_location); 230 panel_manager->ResizeByMouse(mouse_location);
231 231
232 bounds.set_height(panel->min_size().height()); 232 bounds.set_height(panel->min_size().height());
233 EXPECT_EQ(bounds, panel->GetBounds()); 233 EXPECT_EQ(bounds, panel->GetBounds());
234 234
235 panel_manager->EndResizingByMouse(false); 235 panel_manager->EndResizingByMouse(false);
236 EXPECT_EQ(bounds, panel->GetBounds()); 236 EXPECT_EQ(bounds, panel->GetBounds());
237 237
238 // Make sure the panel does not resize larger than its size. 238 // Make sure the panel can resize larger than its size. User is in control.
239 mouse_location = bounds.origin().Add( 239 mouse_location = bounds.origin().Add(
240 gfx::Point(bounds.width(), bounds.height() - 2)); 240 gfx::Point(bounds.width(), bounds.height() - 2));
241 panel_manager->StartResizingByMouse(panel, mouse_location, 241 panel_manager->StartResizingByMouse(panel, mouse_location,
242 panel::RESIZE_BOTTOM_RIGHT); 242 panel::RESIZE_BOTTOM_RIGHT);
243 mouse_location.Offset(500, 40); 243
244 // This drag would take us beyond max size.
245 int delta_x = panel->max_size().width() + 10 - panel->GetBounds().width();
246 int delta_y = panel->max_size().height() + 10 - panel->GetBounds().height();
247 mouse_location.Offset(delta_x, delta_y);
244 panel_manager->ResizeByMouse(mouse_location); 248 panel_manager->ResizeByMouse(mouse_location);
245 249
246 bounds.set_size(gfx::Size(panel->max_size().width(), bounds.height() + 40)); 250 // The bounds if the max_size does not limit the resize.
251 bounds.set_width(bounds.width() + delta_x);
jennb 2012/04/28 00:09:49 stick with bounds.set_size() for consistency in fi
Dmitry Titov 2012/04/28 00:57:40 Done.
252 bounds.set_height(bounds.height() + delta_y);
247 EXPECT_EQ(bounds, panel->GetBounds()); 253 EXPECT_EQ(bounds, panel->GetBounds());
248 254
249 panel_manager->EndResizingByMouse(false); 255 panel_manager->EndResizingByMouse(false);
250 EXPECT_EQ(bounds, panel->GetBounds()); 256 EXPECT_EQ(bounds, panel->GetBounds());
251 257
252 PanelManager::GetInstance()->CloseAll(); 258 PanelManager::GetInstance()->CloseAll();
253 } 259 }
254 260
255 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, CloseDetachedPanelOnResize) { 261 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, CloseDetachedPanelOnResize) {
256 PanelManager* panel_manager = PanelManager::GetInstance(); 262 PanelManager* panel_manager = PanelManager::GetInstance();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 bounds.set_size(gfx::Size(bounds.width() + 10, bounds.height() + 15)); 358 bounds.set_size(gfx::Size(bounds.width() + 10, bounds.height() + 15));
353 bounds.Offset(-10, 0); 359 bounds.Offset(-10, 0);
354 EXPECT_EQ(bounds, panel->GetBounds()); 360 EXPECT_EQ(bounds, panel->GetBounds());
355 361
356 panel_manager->EndResizingByMouse(true); 362 panel_manager->EndResizingByMouse(true);
357 EXPECT_EQ(original_bounds, panel->GetBounds()); 363 EXPECT_EQ(original_bounds, panel->GetBounds());
358 EXPECT_FALSE(resize_controller->IsResizing()); 364 EXPECT_FALSE(resize_controller->IsResizing());
359 365
360 panel_manager->CloseAll(); 366 panel_manager->CloseAll();
361 } 367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698