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

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

Issue 10544105: Modify old Panel test files and include them in .gyp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude new panel browser tests files from chromeos Created 8 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
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/old_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
11 class PanelResizeBrowserTest : public BasePanelBrowserTest { 11 class OldPanelResizeBrowserTest : public OldBasePanelBrowserTest {
12 public: 12 public:
13 PanelResizeBrowserTest() : BasePanelBrowserTest() { 13 OldPanelResizeBrowserTest() : OldBasePanelBrowserTest() {
14 } 14 }
15 15
16 virtual ~PanelResizeBrowserTest() { 16 virtual ~OldPanelResizeBrowserTest() {
17 } 17 }
18 18
19 virtual void SetUpOnMainThread() OVERRIDE { 19 virtual void SetUpOnMainThread() OVERRIDE {
20 BasePanelBrowserTest::SetUpOnMainThread(); 20 OldBasePanelBrowserTest::SetUpOnMainThread();
21 21
22 // All the tests here assume using mocked 800x600 screen area for the 22 // All the tests here assume using mocked 800x600 screen area for the
23 // primary monitor. Do the check now. 23 // primary monitor. Do the check now.
24 gfx::Rect primary_screen_area = PanelManager::GetInstance()-> 24 gfx::Rect primary_screen_area = PanelManager::GetInstance()->
25 display_settings_provider()->GetPrimaryScreenArea(); 25 display_settings_provider()->GetPrimaryScreenArea();
26 DCHECK(primary_screen_area.width() == 800); 26 DCHECK(primary_screen_area.width() == 800);
27 DCHECK(primary_screen_area.height() == 600); 27 DCHECK(primary_screen_area.height() == 600);
28 } 28 }
29 }; 29 };
30 30
31 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, DockedPanelResizability) { 31 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest, DockedPanelResizability) {
32 PanelManager* panel_manager = PanelManager::GetInstance(); 32 PanelManager* panel_manager = PanelManager::GetInstance();
33 Panel* panel = CreatePanel("Panel"); 33 Panel* panel = CreatePanel("Panel");
34 34
35 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES_EXCEPT_BOTTOM, 35 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES_EXCEPT_BOTTOM,
36 panel->CanResizeByMouse()); 36 panel->CanResizeByMouse());
37 37
38 gfx::Rect bounds = panel->GetBounds(); 38 gfx::Rect bounds = panel->GetBounds();
39 39
40 // Try resizing by the top left corner. 40 // Try resizing by the top left corner.
41 gfx::Point mouse_location = bounds.origin(); 41 gfx::Point mouse_location = bounds.origin();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 mouse_location.Offset(20, 10); 140 mouse_location.Offset(20, 10);
141 panel_manager->ResizeByMouse(mouse_location); 141 panel_manager->ResizeByMouse(mouse_location);
142 EXPECT_EQ(bounds, panel->GetBounds()); 142 EXPECT_EQ(bounds, panel->GetBounds());
143 143
144 panel_manager->EndResizingByMouse(false); 144 panel_manager->EndResizingByMouse(false);
145 EXPECT_EQ(bounds, panel->GetBounds()); 145 EXPECT_EQ(bounds, panel->GetBounds());
146 146
147 panel->Close(); 147 panel->Close();
148 } 148 }
149 149
150 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, ResizeDetachedPanel) { 150 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest, ResizeDetachedPanel) {
151 PanelManager* panel_manager = PanelManager::GetInstance(); 151 PanelManager* panel_manager = PanelManager::GetInstance();
152 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100)); 152 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100));
153 153
154 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); 154 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse());
155 155
156 gfx::Rect bounds = panel->GetBounds(); 156 gfx::Rect bounds = panel->GetBounds();
157 157
158 // Try resizing by the right side; verify resize will change width only. 158 // Try resizing by the right side; verify resize will change width only.
159 gfx::Point mouse_location = bounds.origin().Add( 159 gfx::Point mouse_location = bounds.origin().Add(
160 gfx::Point(bounds.width() - 1, 30)); 160 gfx::Point(bounds.width() - 1, 30));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bounds.set_size(gfx::Size(bounds.width() + 20, bounds.height() + 10)); 207 bounds.set_size(gfx::Size(bounds.width() + 20, bounds.height() + 10));
208 bounds.Offset(-20, -10); 208 bounds.Offset(-20, -10);
209 EXPECT_EQ(bounds, panel->GetBounds()); 209 EXPECT_EQ(bounds, panel->GetBounds());
210 210
211 panel_manager->EndResizingByMouse(false); 211 panel_manager->EndResizingByMouse(false);
212 EXPECT_EQ(bounds, panel->GetBounds()); 212 EXPECT_EQ(bounds, panel->GetBounds());
213 213
214 PanelManager::GetInstance()->CloseAll(); 214 PanelManager::GetInstance()->CloseAll();
215 } 215 }
216 216
217 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, ResizeDetachedPanelToClampSize) { 217 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest,
218 ResizeDetachedPanelToClampSize) {
218 PanelManager* panel_manager = PanelManager::GetInstance(); 219 PanelManager* panel_manager = PanelManager::GetInstance();
219 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100)); 220 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100));
220 221
221 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); 222 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse());
222 223
223 gfx::Rect bounds = panel->GetBounds(); 224 gfx::Rect bounds = panel->GetBounds();
224 225
225 // Make sure the panel does not resize smaller than its min size. 226 // Make sure the panel does not resize smaller than its min size.
226 gfx::Point mouse_location = bounds.origin().Add( 227 gfx::Point mouse_location = bounds.origin().Add(
227 gfx::Point(30, bounds.height() - 2)); 228 gfx::Point(30, bounds.height() - 2));
(...skipping 24 matching lines...) Expand all
252 bounds.set_size(gfx::Size(bounds.width() + delta_x, 253 bounds.set_size(gfx::Size(bounds.width() + delta_x,
253 bounds.height() + delta_y)); 254 bounds.height() + delta_y));
254 EXPECT_EQ(bounds, panel->GetBounds()); 255 EXPECT_EQ(bounds, panel->GetBounds());
255 256
256 panel_manager->EndResizingByMouse(false); 257 panel_manager->EndResizingByMouse(false);
257 EXPECT_EQ(bounds, panel->GetBounds()); 258 EXPECT_EQ(bounds, panel->GetBounds());
258 259
259 PanelManager::GetInstance()->CloseAll(); 260 PanelManager::GetInstance()->CloseAll();
260 } 261 }
261 262
262 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, CloseDetachedPanelOnResize) { 263 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest,
264 CloseDetachedPanelOnResize) {
263 PanelManager* panel_manager = PanelManager::GetInstance(); 265 PanelManager* panel_manager = PanelManager::GetInstance();
264 PanelResizeController* resize_controller = panel_manager->resize_controller(); 266 PanelResizeController* resize_controller = panel_manager->resize_controller();
265 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); 267 DetachedPanelStrip* detached_strip = panel_manager->detached_strip();
266 268
267 // Create 3 detached panels. 269 // Create 3 detached panels.
268 Panel* panel1 = CreateDetachedPanel("1", gfx::Rect(100, 200, 100, 100)); 270 Panel* panel1 = CreateDetachedPanel("1", gfx::Rect(100, 200, 100, 100));
269 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(200, 210, 110, 110)); 271 Panel* panel2 = CreateDetachedPanel("2", gfx::Rect(200, 210, 110, 110));
270 Panel* panel3 = CreateDetachedPanel("3", gfx::Rect(300, 220, 120, 120)); 272 Panel* panel3 = CreateDetachedPanel("3", gfx::Rect(300, 220, 120, 120));
271 ASSERT_EQ(3, detached_strip->num_panels()); 273 ASSERT_EQ(3, detached_strip->num_panels());
272 274
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // resizing mode by now. 316 // resizing mode by now.
315 EXPECT_FALSE(resize_controller->IsResizing()); 317 EXPECT_FALSE(resize_controller->IsResizing());
316 318
317 panel_manager->EndResizingByMouse(false); 319 panel_manager->EndResizingByMouse(false);
318 EXPECT_FALSE(resize_controller->IsResizing()); 320 EXPECT_FALSE(resize_controller->IsResizing());
319 EXPECT_EQ(panel1_bounds, panel1->GetBounds()); 321 EXPECT_EQ(panel1_bounds, panel1->GetBounds());
320 322
321 panel_manager->CloseAll(); 323 panel_manager->CloseAll();
322 } 324 }
323 325
324 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, ResizeAndCancel) { 326 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest, ResizeAndCancel) {
325 PanelManager* panel_manager = PanelManager::GetInstance(); 327 PanelManager* panel_manager = PanelManager::GetInstance();
326 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100)); 328 Panel* panel = CreateDetachedPanel("Panel", gfx::Rect(300, 200, 150, 100));
327 PanelResizeController* resize_controller = panel_manager->resize_controller(); 329 PanelResizeController* resize_controller = panel_manager->resize_controller();
328 330
329 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); 331 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse());
330 332
331 gfx::Rect original_bounds = panel->GetBounds(); 333 gfx::Rect original_bounds = panel->GetBounds();
332 334
333 // Resizing the panel, then cancelling should return it to the original state. 335 // Resizing the panel, then cancelling should return it to the original state.
334 // Try resizing by the top right side. 336 // Try resizing by the top right side.
(...skipping 25 matching lines...) Expand all
360 bounds.Offset(-10, 0); 362 bounds.Offset(-10, 0);
361 EXPECT_EQ(bounds, panel->GetBounds()); 363 EXPECT_EQ(bounds, panel->GetBounds());
362 364
363 panel_manager->EndResizingByMouse(true); 365 panel_manager->EndResizingByMouse(true);
364 EXPECT_EQ(original_bounds, panel->GetBounds()); 366 EXPECT_EQ(original_bounds, panel->GetBounds());
365 EXPECT_FALSE(resize_controller->IsResizing()); 367 EXPECT_FALSE(resize_controller->IsResizing());
366 368
367 panel_manager->CloseAll(); 369 panel_manager->CloseAll();
368 } 370 }
369 371
370 IN_PROC_BROWSER_TEST_F(PanelResizeBrowserTest, ResizeDetachedPanelToTop) { 372 IN_PROC_BROWSER_TEST_F(OldPanelResizeBrowserTest, ResizeDetachedPanelToTop) {
371 // Setup the test areas to have top-aligned bar excluded from work area. 373 // Setup the test areas to have top-aligned bar excluded from work area.
372 const gfx::Rect primary_scren_area(0, 0, 800, 600); 374 const gfx::Rect primary_scren_area(0, 0, 800, 600);
373 const gfx::Rect work_area(0, 10, 800, 590); 375 const gfx::Rect work_area(0, 10, 800, 590);
374 SetTestingAreas(primary_scren_area, work_area); 376 SetTestingAreas(primary_scren_area, work_area);
375 377
376 PanelManager* panel_manager = PanelManager::GetInstance(); 378 PanelManager* panel_manager = PanelManager::GetInstance();
377 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); 379 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200));
378 gfx::Rect bounds = panel->GetBounds(); 380 gfx::Rect bounds = panel->GetBounds();
379 381
380 // Try resizing by the top left corner. 382 // Try resizing by the top left corner.
(...skipping 22 matching lines...) Expand all
403 bounds.set_height(bounds.height() + bounds.y() - mouse_location.y()); 405 bounds.set_height(bounds.height() + bounds.y() - mouse_location.y());
404 bounds.set_x(mouse_location.x()); 406 bounds.set_x(mouse_location.x());
405 bounds.set_y(mouse_location.y()); 407 bounds.set_y(mouse_location.y());
406 EXPECT_EQ(bounds, panel->GetBounds()); 408 EXPECT_EQ(bounds, panel->GetBounds());
407 409
408 panel_manager->EndResizingByMouse(false); 410 panel_manager->EndResizingByMouse(false);
409 EXPECT_EQ(bounds, panel->GetBounds()); 411 EXPECT_EQ(bounds, panel->GetBounds());
410 412
411 panel_manager->CloseAll(); 413 panel_manager->CloseAll();
412 } 414 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/old_panel_drag_browsertest.cc ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698