OLD | NEW |
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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
7 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 7 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
8 #include "chrome/browser/ui/panels/panel.h" | 8 #include "chrome/browser/ui/panels/panel.h" |
9 #include "chrome/browser/ui/panels/panel_manager.h" | 9 #include "chrome/browser/ui/panels/panel_manager.h" |
10 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 10 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
11 | 11 |
12 class OldDockedPanelBrowserTest : public OldBasePanelBrowserTest { | 12 class DockedPanelBrowserTest : public BasePanelBrowserTest { |
13 public: | 13 public: |
14 virtual void SetUpOnMainThread() OVERRIDE { | 14 virtual void SetUpOnMainThread() OVERRIDE { |
15 OldBasePanelBrowserTest::SetUpOnMainThread(); | 15 BasePanelBrowserTest::SetUpOnMainThread(); |
16 | 16 |
17 // All the tests here assume using mocked 800x600 screen area for the | 17 // All the tests here assume using mocked 800x600 screen area for the |
18 // primary monitor. Do the check now. | 18 // primary monitor. Do the check now. |
19 gfx::Rect primary_screen_area = PanelManager::GetInstance()-> | 19 gfx::Rect primary_screen_area = PanelManager::GetInstance()-> |
20 display_settings_provider()->GetPrimaryScreenArea(); | 20 display_settings_provider()->GetPrimaryScreenArea(); |
21 DCHECK(primary_screen_area.width() == 800); | 21 DCHECK(primary_screen_area.width() == 800); |
22 DCHECK(primary_screen_area.height() == 600); | 22 DCHECK(primary_screen_area.height() == 600); |
23 } | 23 } |
24 }; | 24 }; |
25 | 25 |
26 IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, SqueezePanelsInDock) { | 26 IN_PROC_BROWSER_TEST_F(DockedPanelBrowserTest, SqueezePanelsInDock) { |
27 PanelManager* panel_manager = PanelManager::GetInstance(); | 27 PanelManager* panel_manager = PanelManager::GetInstance(); |
28 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); | 28 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); |
29 | 29 |
30 // Create some docked panels. | 30 // Create some docked panels. |
31 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); | 31 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); |
32 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); | 32 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); |
33 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); | 33 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); |
34 ASSERT_EQ(3, docked_strip->num_panels()); | 34 ASSERT_EQ(3, docked_strip->num_panels()); |
35 | 35 |
36 // Check that nothing has been squeezed so far. | 36 // Check that nothing has been squeezed so far. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 EXPECT_LT(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); | 78 EXPECT_LT(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); |
79 EXPECT_LT(panel3->GetBounds().width(), panel3->GetRestoredBounds().width()); | 79 EXPECT_LT(panel3->GetBounds().width(), panel3->GetRestoredBounds().width()); |
80 EXPECT_LT(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); | 80 EXPECT_LT(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); |
81 EXPECT_LT(panel5->GetBounds().width(), panel5->GetRestoredBounds().width()); | 81 EXPECT_LT(panel5->GetBounds().width(), panel5->GetRestoredBounds().width()); |
82 EXPECT_LT(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); | 82 EXPECT_LT(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); |
83 EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width()); | 83 EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width()); |
84 | 84 |
85 panel_manager->CloseAll(); | 85 panel_manager->CloseAll(); |
86 } | 86 } |
87 | 87 |
88 IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, SqueezeAndThenSomeMore) { | 88 IN_PROC_BROWSER_TEST_F(DockedPanelBrowserTest, SqueezeAndThenSomeMore) { |
89 PanelManager* panel_manager = PanelManager::GetInstance(); | 89 PanelManager* panel_manager = PanelManager::GetInstance(); |
90 | 90 |
91 // Create enough docked panels to get into squeezing. | 91 // Create enough docked panels to get into squeezing. |
92 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); | 92 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); |
93 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); | 93 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); |
94 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); | 94 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); |
95 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); | 95 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); |
96 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); | 96 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); |
97 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); | 97 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); |
98 | 98 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // The panels should shrink in width. | 130 // The panels should shrink in width. |
131 EXPECT_LT(panel1->GetBounds().width(), panel_1_width_less_squeezed); | 131 EXPECT_LT(panel1->GetBounds().width(), panel_1_width_less_squeezed); |
132 EXPECT_LT(panel2->GetBounds().width(), panel_2_width_less_squeezed); | 132 EXPECT_LT(panel2->GetBounds().width(), panel_2_width_less_squeezed); |
133 EXPECT_LT(panel3->GetBounds().width(), panel_3_width_less_squeezed); | 133 EXPECT_LT(panel3->GetBounds().width(), panel_3_width_less_squeezed); |
134 EXPECT_LT(panel4->GetBounds().width(), panel_4_width_less_squeezed); | 134 EXPECT_LT(panel4->GetBounds().width(), panel_4_width_less_squeezed); |
135 EXPECT_LT(panel5->GetBounds().width(), panel_5_width_less_squeezed); | 135 EXPECT_LT(panel5->GetBounds().width(), panel_5_width_less_squeezed); |
136 | 136 |
137 panel_manager->CloseAll(); | 137 panel_manager->CloseAll(); |
138 } | 138 } |
139 | 139 |
140 IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, MinimizeSqueezedActive) { | 140 IN_PROC_BROWSER_TEST_F(DockedPanelBrowserTest, MinimizeSqueezedActive) { |
141 PanelManager* panel_manager = PanelManager::GetInstance(); | 141 PanelManager* panel_manager = PanelManager::GetInstance(); |
142 | 142 |
143 // Create enough docked panels to get into squeezing. | 143 // Create enough docked panels to get into squeezing. |
144 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); | 144 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); |
145 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); | 145 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); |
146 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); | 146 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); |
147 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); | 147 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); |
148 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); | 148 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); |
149 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); | 149 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); |
150 Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100)); | 150 Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 // Wait for the scheduled layout to run. | 185 // Wait for the scheduled layout to run. |
186 MessageLoopForUI::current()->RunAllPending(); | 186 MessageLoopForUI::current()->RunAllPending(); |
187 | 187 |
188 // The minimized panel should now be at reduced width. | 188 // The minimized panel should now be at reduced width. |
189 EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width()); | 189 EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width()); |
190 | 190 |
191 panel_manager->CloseAll(); | 191 panel_manager->CloseAll(); |
192 } | 192 } |
193 | 193 |
194 IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, CloseSqueezedPanels) { | 194 IN_PROC_BROWSER_TEST_F(DockedPanelBrowserTest, CloseSqueezedPanels) { |
195 PanelManager* panel_manager = PanelManager::GetInstance(); | 195 PanelManager* panel_manager = PanelManager::GetInstance(); |
196 | 196 |
197 // Create enough docked panels to get into squeezing. | 197 // Create enough docked panels to get into squeezing. |
198 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); | 198 Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100)); |
199 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); | 199 Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100)); |
200 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); | 200 Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100)); |
201 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); | 201 Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100)); |
202 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); | 202 Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100)); |
203 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); | 203 Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100)); |
204 Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100)); | 204 Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // Wait for all processing to finish. | 253 // Wait for all processing to finish. |
254 MessageLoopForUI::current()->RunAllPending(); | 254 MessageLoopForUI::current()->RunAllPending(); |
255 | 255 |
256 // We should not have squeezing any more; all panels should be at full width. | 256 // We should not have squeezing any more; all panels should be at full width. |
257 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); | 257 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); |
258 EXPECT_EQ(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); | 258 EXPECT_EQ(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); |
259 EXPECT_EQ(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); | 259 EXPECT_EQ(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); |
260 | 260 |
261 panel_manager->CloseAll(); | 261 panel_manager->CloseAll(); |
262 } | 262 } |
OLD | NEW |