Chromium Code Reviews| 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 <vector> | 5 #include <vector> |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 7 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 8 #include "chrome/browser/ui/panels/native_panel.h" | 8 #include "chrome/browser/ui/panels/native_panel.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
| 11 #include "chrome/browser/ui/panels/panel_overflow_indicator.h" | 11 #include "chrome/browser/ui/panels/panel_overflow_indicator.h" |
| 12 #include "chrome/browser/ui/panels/panel_overflow_strip.h" | 12 #include "chrome/browser/ui/panels/panel_overflow_strip.h" |
| 13 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" | 13 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" |
| 14 #include "chrome/browser/ui/panels/panel_strip.h" | 14 #include "chrome/browser/ui/panels/panel_strip.h" |
| 15 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 15 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // We override the default value for testing purpose. | 22 // We override the default value for testing purpose. |
| 23 const int kMaxVisibleOverflowPanelsForTesting = 3; | 23 const int kMaxVisibleOverflowPanelsForTesting = 3; |
| 24 const int kMaxVisibleOverflowPanelsOnHoverForTesting = 6; | 24 const int kMaxVisibleOverflowPanelsOnHoverForTesting = 6; |
| 25 | 25 |
| 26 // Encapsulates all the info we need to verify if a panel behaves as expected | 26 // Encapsulates all the info we need to verify if a panel behaves as expected |
| 27 // when we do the overflow testing. | 27 // when we do the overflow testing. |
| 28 struct PanelData { | 28 struct PanelData { |
| 29 Panel* panel; | 29 Panel* panel; |
| 30 Panel::StripOwner strip_owner; | |
| 30 Panel::ExpansionState expansion_state; | 31 Panel::ExpansionState expansion_state; |
| 31 bool visible; | 32 bool visible; |
| 32 bool active; | 33 bool active; |
| 33 | 34 |
| 34 explicit PanelData(Panel* panel) | 35 explicit PanelData(Panel* panel) |
| 35 : panel(panel), | 36 : panel(panel), |
| 37 strip_owner(panel->strip_owner()), | |
| 36 expansion_state(panel->expansion_state()), | 38 expansion_state(panel->expansion_state()), |
| 37 visible(!panel->GetBounds().IsEmpty()), | 39 visible(!panel->GetBounds().IsEmpty()), |
| 38 active(panel->IsActive()) { | 40 active(panel->IsActive()) { |
| 39 } | 41 } |
| 40 | 42 |
| 41 PanelData(Panel* panel, Panel::ExpansionState expansion_state, | 43 PanelData(Panel* panel, Panel::StripOwner strip_owner, |
| 44 Panel::ExpansionState expansion_state, | |
| 42 bool visible, bool active) | 45 bool visible, bool active) |
| 43 : panel(panel), | 46 : panel(panel), |
| 47 strip_owner(strip_owner), | |
| 44 expansion_state(expansion_state), | 48 expansion_state(expansion_state), |
| 45 visible(visible), | 49 visible(visible), |
| 46 active(active) { | 50 active(active) { |
| 47 } | 51 } |
| 48 | 52 |
| 49 bool operator==(const PanelData& another) const { | 53 bool operator==(const PanelData& another) const { |
| 54 if (strip_owner != another.strip_owner) | |
| 55 return false; | |
| 56 if (strip_owner == Panel::DOCKED && | |
| 57 expansion_state != another.expansion_state) | |
| 58 return false; | |
| 50 return panel == another.panel && | 59 return panel == another.panel && |
| 51 expansion_state == another.expansion_state && | |
| 52 visible == another.visible && | 60 visible == another.visible && |
| 53 active == another.active; | 61 active == another.active; |
| 54 } | 62 } |
| 55 | 63 |
| 56 bool operator!=(const PanelData& another) const { | 64 bool operator!=(const PanelData& another) const { |
| 57 return !(*this == another); | 65 return !(*this == another); |
| 58 } | 66 } |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 // For gtest printing. | 69 // For gtest printing. |
| 62 ::std::ostream& operator<<(::std::ostream& os, const PanelData& data); | |
| 63 ::std::ostream& operator<<(::std::ostream& os, const PanelData& data) { | 70 ::std::ostream& operator<<(::std::ostream& os, const PanelData& data) { |
| 64 return os << "(" << data.panel->browser()->app_name() << ", " | 71 return os << "(" << data.panel->browser()->app_name() << ", " |
| 65 << data.expansion_state << ", " << data.visible << ", " | 72 << data.strip_owner << ", " << data.expansion_state << ", " |
| 66 << data.active << ")"; | 73 << data.visible << ", " << data.active << ")"; |
| 67 } | 74 } |
| 68 | 75 |
| 76 class PanelDataList : public std::vector<PanelData> { | |
| 77 }; | |
| 69 | 78 |
| 70 class PanelDataList : public std::vector<PanelData> { | 79 class NormalPanelDataList : public PanelDataList { |
| 71 public: | 80 public: |
| 72 void Add(Panel* panel, Panel::ExpansionState expansion_state, | 81 void Add(Panel* panel, Panel::ExpansionState expansion_state, |
| 73 bool visible, bool active) { | 82 bool visible, bool active) { |
|
jennb
2012/01/19 18:41:21
visible param not needed
jianli
2012/01/19 22:24:41
The overflow panel might be hidden and it comes ou
jennb
2012/01/19 23:44:09
Aren't all panels in the NormalPanelDataList visib
| |
| 74 push_back(PanelData(panel, expansion_state, visible, active)); | 83 push_back(PanelData(panel, Panel::DOCKED, expansion_state, |
| 84 visible, active)); | |
| 75 } | 85 } |
| 76 }; | 86 }; |
| 77 | 87 |
| 88 class OverflowPanelDataList : public PanelDataList { | |
| 89 public: | |
| 90 void Add(Panel* panel, bool visible, bool active) { | |
| 91 push_back(PanelData(panel, Panel::IN_OVERFLOW, Panel::EXPANDED, | |
|
jennb
2012/01/19 18:41:21
Some tests will be putting minimized panels into o
jianli
2012/01/19 22:24:41
Yes, but we don't care how the minimized state is
| |
| 92 visible, active)); | |
| 93 } | |
| 94 }; | |
| 95 | |
| 78 } // namespace | 96 } // namespace |
| 79 | 97 |
| 80 class PanelOverflowBrowserTest : public BasePanelBrowserTest { | 98 class PanelOverflowBrowserTest : public BasePanelBrowserTest { |
| 81 public: | 99 public: |
| 82 PanelOverflowBrowserTest() : BasePanelBrowserTest() { | 100 PanelOverflowBrowserTest() : BasePanelBrowserTest() { |
| 83 } | 101 } |
| 84 | 102 |
| 85 virtual ~PanelOverflowBrowserTest() { | 103 virtual ~PanelOverflowBrowserTest() { |
| 86 } | 104 } |
| 87 | 105 |
| 88 virtual void SetUpOnMainThread() OVERRIDE { | 106 virtual void SetUpOnMainThread() OVERRIDE { |
| 89 BasePanelBrowserTest::SetUpOnMainThread(); | 107 BasePanelBrowserTest::SetUpOnMainThread(); |
| 90 | 108 |
| 91 PanelManager* panel_manager = PanelManager::GetInstance(); | 109 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 92 panel_manager->panel_overflow_strip()->set_max_visible_panels( | 110 panel_manager->panel_overflow_strip()->set_max_visible_panels( |
| 93 kMaxVisibleOverflowPanelsForTesting); | 111 kMaxVisibleOverflowPanelsForTesting); |
| 94 panel_manager->panel_overflow_strip()->set_max_visible_panels_on_hover( | 112 panel_manager->panel_overflow_strip()->set_max_visible_panels_on_hover( |
| 95 kMaxVisibleOverflowPanelsOnHoverForTesting); | 113 kMaxVisibleOverflowPanelsOnHoverForTesting); |
| 96 | 114 |
| 97 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | 115 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); |
| 98 panel_manager->SetMouseWatcherForTesting(mouse_watcher); | 116 panel_manager->SetMouseWatcherForTesting(mouse_watcher); |
| 99 | 117 |
| 100 // All the overflow tests assume 800x600 work area. Do the check now. | 118 // All the overflow tests assume 800x600 work area. Do the check now. |
| 101 DCHECK(PanelManager::GetInstance()->work_area().width() == 800); | 119 DCHECK(PanelManager::GetInstance()->work_area().width() == 800); |
| 102 } | 120 } |
| 103 | 121 |
| 104 protected: | 122 protected: |
| 105 static PanelDataList GetAllNormalPanelData() { | 123 static NormalPanelDataList GetAllNormalPanelData() { |
| 106 PanelDataList panel_data_list; | 124 NormalPanelDataList panel_data_list; |
| 107 PanelStrip::Panels panels = | 125 PanelStrip::Panels panels = |
| 108 PanelManager::GetInstance()->panel_strip()->panels(); | 126 PanelManager::GetInstance()->panel_strip()->panels(); |
| 109 for (PanelStrip::Panels::const_iterator iter = panels.begin(); | 127 for (PanelStrip::Panels::const_iterator iter = panels.begin(); |
| 110 iter != panels.end(); ++iter) { | 128 iter != panels.end(); ++iter) { |
| 111 Panel* panel = *iter; | 129 Panel* panel = *iter; |
| 112 panel_data_list.push_back(PanelData(panel)); | 130 panel_data_list.push_back(PanelData(panel)); |
| 113 } | 131 } |
| 114 return panel_data_list; | 132 return panel_data_list; |
| 115 } | 133 } |
| 116 | 134 |
| 117 static PanelDataList GetAllOverflowPanelData() { | 135 static OverflowPanelDataList GetAllOverflowPanelData() { |
| 118 PanelDataList panel_data_list; | 136 OverflowPanelDataList panel_data_list; |
| 119 PanelOverflowStrip::Panels panels = | 137 PanelOverflowStrip::Panels panels = |
| 120 PanelManager::GetInstance()->panel_overflow_strip()->panels(); | 138 PanelManager::GetInstance()->panel_overflow_strip()->panels(); |
| 121 for (PanelOverflowStrip::Panels::const_iterator iter = panels.begin(); | 139 for (PanelOverflowStrip::Panels::const_iterator iter = panels.begin(); |
| 122 iter != panels.end(); ++iter) { | 140 iter != panels.end(); ++iter) { |
| 123 Panel* panel = *iter; | 141 Panel* panel = *iter; |
| 124 panel_data_list.push_back(PanelData(panel)); | 142 panel_data_list.push_back(PanelData(panel)); |
| 125 } | 143 } |
| 126 return panel_data_list; | 144 return panel_data_list; |
| 127 } | 145 } |
| 128 | 146 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 } | 188 } |
| 171 | 189 |
| 172 // Then, create panels that would be placed in the overflow strip. | 190 // Then, create panels that would be placed in the overflow strip. |
| 173 int num_panels = num_normal_panels + num_overflow_panels; | 191 int num_panels = num_normal_panels + num_overflow_panels; |
| 174 for (; i < num_panels; ++i) { | 192 for (; i < num_panels; ++i) { |
| 175 CreatePanelParams params( | 193 CreatePanelParams params( |
| 176 MakePanelName(i), | 194 MakePanelName(i), |
| 177 gfx::Rect(0, 0, panel_widths[i], kTestPanelHeight), | 195 gfx::Rect(0, 0, panel_widths[i], kTestPanelHeight), |
| 178 SHOW_AS_INACTIVE); | 196 SHOW_AS_INACTIVE); |
| 179 Panel* panel = CreatePanelWithParams(params); | 197 Panel* panel = CreatePanelWithParams(params); |
| 180 WaitForExpansionStateChanged(panel, Panel::IN_OVERFLOW); | 198 WaitForStripOwnerChanged(panel, Panel::IN_OVERFLOW); |
| 181 panels.push_back(panel); | 199 panels.push_back(panel); |
| 182 } | 200 } |
| 183 | 201 |
| 184 return panels; | 202 return panels; |
| 185 } | 203 } |
| 186 }; | 204 }; |
| 187 | 205 |
| 188 // TODO(jianli): remove the guard when overflow support is enabled on other | 206 // TODO(jianli): remove the guard when overflow support is enabled on other |
| 189 // platforms. http://crbug.com/105073 | 207 // platforms. http://crbug.com/105073 |
| 190 #if defined(OS_WIN) | 208 #if defined(OS_WIN) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 EXPECT_FALSE(panel2->has_temporary_layout()); | 272 EXPECT_FALSE(panel2->has_temporary_layout()); |
| 255 EXPECT_FALSE(panel3->has_temporary_layout()); | 273 EXPECT_FALSE(panel3->has_temporary_layout()); |
| 256 EXPECT_TRUE(panel4->has_temporary_layout()); | 274 EXPECT_TRUE(panel4->has_temporary_layout()); |
| 257 | 275 |
| 258 EXPECT_TRUE(panel1->draggable()); | 276 EXPECT_TRUE(panel1->draggable()); |
| 259 EXPECT_TRUE(panel2->draggable()); | 277 EXPECT_TRUE(panel2->draggable()); |
| 260 EXPECT_TRUE(panel3->draggable()); | 278 EXPECT_TRUE(panel3->draggable()); |
| 261 EXPECT_FALSE(panel4->draggable()); | 279 EXPECT_FALSE(panel4->draggable()); |
| 262 | 280 |
| 263 // Make sure last panel really did overflow. | 281 // Make sure last panel really did overflow. |
| 264 WaitForExpansionStateChanged(panel4, Panel::IN_OVERFLOW); | 282 WaitForStripOwnerChanged(panel4, Panel::IN_OVERFLOW); |
| 265 EXPECT_FALSE(panel4->has_temporary_layout()); | 283 EXPECT_FALSE(panel4->has_temporary_layout()); |
| 266 EXPECT_FALSE(panel4->draggable()); | 284 EXPECT_FALSE(panel4->draggable()); |
| 267 | 285 |
| 268 PanelManager::GetInstance()->RemoveAll(); | 286 PanelManager::GetInstance()->RemoveAll(); |
| 269 } | 287 } |
| 270 | 288 |
| 271 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_UpdateDraggableStatus) { | 289 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_UpdateDraggableStatus) { |
| 272 Panel* panel = CreatePanel("panel"); | 290 Panel* panel = CreatePanel("panel"); |
| 273 EXPECT_TRUE(panel->draggable()); | 291 EXPECT_TRUE(panel->draggable()); |
| 274 panel->SetExpansionState(Panel::IN_OVERFLOW); | 292 panel->SetStripOwner(Panel::IN_OVERFLOW); |
| 275 EXPECT_FALSE(panel->draggable()); | 293 EXPECT_FALSE(panel->draggable()); |
| 276 panel->SetExpansionState(Panel::EXPANDED); | 294 panel->SetStripOwner(Panel::DOCKED); |
| 277 EXPECT_TRUE(panel->draggable()); | 295 EXPECT_TRUE(panel->draggable()); |
| 278 panel->Close(); | 296 panel->Close(); |
| 279 } | 297 } |
| 280 | 298 |
| 281 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) { | 299 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) { |
| 282 PanelManager* panel_manager = PanelManager::GetInstance(); | 300 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 283 PanelStrip* panel_strip = panel_manager->panel_strip(); | 301 PanelStrip* panel_strip = panel_manager->panel_strip(); |
| 284 PanelOverflowStrip* panel_overflow_strip = | 302 PanelOverflowStrip* panel_overflow_strip = |
| 285 panel_manager->panel_overflow_strip(); | 303 panel_manager->panel_overflow_strip(); |
| 286 | 304 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 299 EXPECT_EQ(0, panel_overflow_strip->num_panels()); | 317 EXPECT_EQ(0, panel_overflow_strip->num_panels()); |
| 300 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); | 318 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); |
| 301 EXPECT_EQ(Panel::EXPANDED, panel0->expansion_state()); | 319 EXPECT_EQ(Panel::EXPANDED, panel0->expansion_state()); |
| 302 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); | 320 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); |
| 303 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); | 321 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); |
| 304 | 322 |
| 305 // Create 1 overflow panel. | 323 // Create 1 overflow panel. |
| 306 CreatePanelParams params( | 324 CreatePanelParams params( |
| 307 "Panel3", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 325 "Panel3", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
| 308 Panel* panel3 = CreatePanelWithParams(params); | 326 Panel* panel3 = CreatePanelWithParams(params); |
| 309 WaitForExpansionStateChanged(panel3, Panel::IN_OVERFLOW); | 327 WaitForStripOwnerChanged(panel3, Panel::IN_OVERFLOW); |
| 310 | 328 |
| 311 EXPECT_EQ(4, panel_manager->num_panels()); | 329 EXPECT_EQ(4, panel_manager->num_panels()); |
| 312 EXPECT_EQ(3, panel_strip->num_panels()); | 330 EXPECT_EQ(3, panel_strip->num_panels()); |
| 313 EXPECT_EQ(1, panel_overflow_strip->num_panels()); | 331 EXPECT_EQ(1, panel_overflow_strip->num_panels()); |
| 314 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); | 332 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); |
| 315 EXPECT_TRUE(IsPanelVisible(panel3)); | 333 EXPECT_TRUE(IsPanelVisible(panel3)); |
| 316 EXPECT_TRUE(IsPanelInOverflowStrip(panel3)); | 334 EXPECT_TRUE(IsPanelInOverflowStrip(panel3)); |
| 317 EXPECT_EQ(gfx::Size(255, 200), panel3->restored_size()); | 335 EXPECT_EQ(gfx::Size(255, 200), panel3->restored_size()); |
| 318 | 336 |
| 319 // Create 1 more overflow panel. | 337 // Create 1 more overflow panel. |
| 320 params.name = "Panel4"; | 338 params.name = "Panel4"; |
| 321 Panel* panel4 = CreatePanelWithParams(params); | 339 Panel* panel4 = CreatePanelWithParams(params); |
| 322 WaitForExpansionStateChanged(panel4, Panel::IN_OVERFLOW); | 340 WaitForStripOwnerChanged(panel4, Panel::IN_OVERFLOW); |
| 323 | 341 |
| 324 EXPECT_EQ(5, panel_manager->num_panels()); | 342 EXPECT_EQ(5, panel_manager->num_panels()); |
| 325 EXPECT_EQ(3, panel_strip->num_panels()); | 343 EXPECT_EQ(3, panel_strip->num_panels()); |
| 326 EXPECT_EQ(2, panel_overflow_strip->num_panels()); | 344 EXPECT_EQ(2, panel_overflow_strip->num_panels()); |
| 327 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); | 345 EXPECT_FALSE(panel_overflow_strip->overflow_indicator()); |
| 328 EXPECT_TRUE(IsPanelVisible(panel4)); | 346 EXPECT_TRUE(IsPanelVisible(panel4)); |
| 329 | 347 |
| 330 PanelManager::GetInstance()->RemoveAll(); | 348 PanelManager::GetInstance()->RemoveAll(); |
| 331 } | 349 } |
| 332 | 350 |
| 333 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 351 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
| 334 MAYBE_CreateMoreOverflowPanels) { | 352 MAYBE_CreateMoreOverflowPanels) { |
| 335 PanelManager* panel_manager = PanelManager::GetInstance(); | 353 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 336 PanelStrip* panel_strip = panel_manager->panel_strip(); | 354 PanelStrip* panel_strip = panel_manager->panel_strip(); |
| 337 PanelOverflowStrip* panel_overflow_strip = | 355 PanelOverflowStrip* panel_overflow_strip = |
| 338 panel_manager->panel_overflow_strip(); | 356 panel_manager->panel_overflow_strip(); |
| 339 | 357 |
| 340 const int panel_widths[] = { | 358 const int panel_widths[] = { |
| 341 250, 260, 200, // normal | 359 250, 260, 200, // normal |
| 342 255, 220, 210, // overflow | 360 255, 220, 210, // overflow |
| 343 220, 230 // overflow-on-overflow | 361 220, 230 // overflow-on-overflow |
| 344 }; | 362 }; |
| 345 CreateOverflowPanels(3, 5, panel_widths); | 363 CreateOverflowPanels(3, 5, panel_widths); |
| 346 | 364 |
| 347 std::vector<Panel*> panels = panel_manager->panels(); | 365 std::vector<Panel*> panels = panel_manager->panels(); |
| 348 ASSERT_EQ(8u, panels.size()); | 366 ASSERT_EQ(8u, panels.size()); |
| 349 EXPECT_EQ(3, panel_strip->num_panels()); | 367 EXPECT_EQ(3, panel_strip->num_panels()); |
| 350 EXPECT_EQ(5, panel_overflow_strip->num_panels()); | 368 EXPECT_EQ(5, panel_overflow_strip->num_panels()); |
| 351 EXPECT_EQ(2, panel_overflow_strip->overflow_indicator()->GetCount()); | 369 EXPECT_EQ(2, panel_overflow_strip->overflow_indicator()->GetCount()); |
| 352 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->expansion_state()); | 370 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->strip_owner()); |
| 353 EXPECT_TRUE(IsPanelVisible(panels[3])); | 371 EXPECT_TRUE(IsPanelVisible(panels[3])); |
| 354 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->expansion_state()); | 372 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->strip_owner()); |
| 355 EXPECT_TRUE(IsPanelVisible(panels[4])); | 373 EXPECT_TRUE(IsPanelVisible(panels[4])); |
| 356 EXPECT_EQ(Panel::IN_OVERFLOW, panels[5]->expansion_state()); | 374 EXPECT_EQ(Panel::IN_OVERFLOW, panels[5]->strip_owner()); |
| 357 EXPECT_TRUE(IsPanelVisible(panels[5])); | 375 EXPECT_TRUE(IsPanelVisible(panels[5])); |
| 358 EXPECT_EQ(Panel::IN_OVERFLOW, panels[6]->expansion_state()); | 376 EXPECT_EQ(Panel::IN_OVERFLOW, panels[6]->strip_owner()); |
| 359 EXPECT_FALSE(IsPanelVisible(panels[6])); | 377 EXPECT_FALSE(IsPanelVisible(panels[6])); |
| 360 EXPECT_EQ(Panel::IN_OVERFLOW, panels[7]->expansion_state()); | 378 EXPECT_EQ(Panel::IN_OVERFLOW, panels[7]->strip_owner()); |
| 361 EXPECT_FALSE(IsPanelVisible(panels[7])); | 379 EXPECT_FALSE(IsPanelVisible(panels[7])); |
| 362 | 380 |
| 363 PanelManager::GetInstance()->RemoveAll(); | 381 PanelManager::GetInstance()->RemoveAll(); |
| 364 } | 382 } |
| 365 | 383 |
| 366 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 384 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
| 367 MAYBE_CreatePanelOnDelayedOverflow) { | 385 MAYBE_CreatePanelOnDelayedOverflow) { |
| 368 // Create 2 big panels. | 386 // Create 2 big panels. |
| 369 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); | 387 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); |
| 370 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); | 388 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); |
| 371 | 389 |
| 372 // Create an overflow panel without waiting for it to be moved to overflow. | 390 // Create an overflow panel without waiting for it to be moved to overflow. |
| 373 CreatePanelParams params( | 391 CreatePanelParams params( |
| 374 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 392 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
| 375 params.wait_for_fully_created = false; | 393 params.wait_for_fully_created = false; |
| 376 Panel* overflow_panel = CreatePanelWithParams(params); | 394 Panel* overflow_panel = CreatePanelWithParams(params); |
| 377 EXPECT_EQ(Panel::EXPANDED, overflow_panel->expansion_state()); | 395 EXPECT_EQ(Panel::EXPANDED, overflow_panel->expansion_state()); |
| 378 EXPECT_TRUE(overflow_panel->has_temporary_layout()); | 396 EXPECT_TRUE(overflow_panel->has_temporary_layout()); |
| 379 | 397 |
| 380 // Create a small panel that could fit within the available space in the | 398 // Create a small panel that could fit within the available space in the |
| 381 // panel strip. | 399 // panel strip. |
| 382 CreatePanelParams params2( | 400 CreatePanelParams params2( |
| 383 "Panel3", gfx::Rect(0, 0, 110, 200), SHOW_AS_INACTIVE); | 401 "Panel3", gfx::Rect(0, 0, 110, 200), SHOW_AS_INACTIVE); |
| 384 Panel* panel3 = CreatePanelWithParams(params2); | 402 Panel* panel3 = CreatePanelWithParams(params2); |
| 385 EXPECT_EQ(Panel::EXPANDED, panel3->expansion_state()); | 403 EXPECT_EQ(Panel::EXPANDED, panel3->expansion_state()); |
| 386 EXPECT_FALSE(panel3->has_temporary_layout()); | 404 EXPECT_FALSE(panel3->has_temporary_layout()); |
| 387 | 405 |
| 388 WaitForExpansionStateChanged(overflow_panel, Panel::IN_OVERFLOW); | 406 WaitForStripOwnerChanged(overflow_panel, Panel::IN_OVERFLOW); |
| 389 EXPECT_FALSE(overflow_panel->has_temporary_layout()); | 407 EXPECT_FALSE(overflow_panel->has_temporary_layout()); |
| 390 PanelManager::GetInstance()->RemoveAll(); | 408 PanelManager::GetInstance()->RemoveAll(); |
| 391 } | 409 } |
| 392 | 410 |
| 393 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CloseOverflowPanels) { | 411 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CloseOverflowPanels) { |
| 394 PanelManager* panel_manager = PanelManager::GetInstance(); | 412 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 395 PanelStrip* panel_strip = panel_manager->panel_strip(); | 413 PanelStrip* panel_strip = panel_manager->panel_strip(); |
| 396 PanelOverflowStrip* panel_overflow_strip = | 414 PanelOverflowStrip* panel_overflow_strip = |
| 397 panel_manager->panel_overflow_strip(); | 415 panel_manager->panel_overflow_strip(); |
| 398 | 416 |
| 399 // Create normal and overflow panels. | 417 // Create normal and overflow panels. |
| 400 // normal: P0, P1, P2 | 418 // normal: P0, P1, P2 |
| 401 // overflow: P3, P4, P5 | 419 // overflow: P3, P4, P5 |
| 402 // overflow-on-overflow: P6, P7 | 420 // overflow-on-overflow: P6, P7 |
| 403 int num_normal_panels = 3; | 421 int num_normal_panels = 3; |
| 404 int num_overflow_panels = 5; | 422 int num_overflow_panels = 5; |
| 405 const int panel_widths[] = { | 423 const int panel_widths[] = { |
| 406 260, 250, 200, // normal | 424 260, 250, 200, // normal |
| 407 255, 260, 120, // overflow | 425 255, 260, 120, // overflow |
| 408 240, 210 // overflow-on-overflow | 426 240, 210 // overflow-on-overflow |
| 409 }; | 427 }; |
| 410 std::vector<Panel*> panels = CreateOverflowPanels( | 428 std::vector<Panel*> panels = CreateOverflowPanels( |
| 411 num_normal_panels, num_overflow_panels, panel_widths); | 429 num_normal_panels, num_overflow_panels, panel_widths); |
| 412 | 430 |
| 413 PanelDataList expected_normal_list; | 431 NormalPanelDataList expected_normal_list; |
| 414 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 432 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 415 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 433 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 416 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 434 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 417 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 435 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 418 | 436 |
| 419 PanelDataList expected_overflow_list; | 437 OverflowPanelDataList expected_overflow_list; |
| 420 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 438 expected_overflow_list.Add(panels[3], true, false); |
| 421 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 439 expected_overflow_list.Add(panels[4], true, false); |
| 422 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 440 expected_overflow_list.Add(panels[5], true, false); |
| 423 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, false, false); | 441 expected_overflow_list.Add(panels[6], false, false); |
| 424 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 442 expected_overflow_list.Add(panels[7], false, false); |
| 425 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 443 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 426 | 444 |
| 427 // Close an overflow-on-overflow panel. Expect only that panel is closed. | 445 // Close an overflow-on-overflow panel. Expect only that panel is closed. |
| 428 // normal: P0, P1, P2 | 446 // normal: P0, P1, P2 |
| 429 // overflow: P3, P4, P5, | 447 // overflow: P3, P4, P5, |
| 430 // overflow-on-overflow: P7 | 448 // overflow-on-overflow: P7 |
| 431 CloseWindowAndWait(panels[6]->browser()); | 449 CloseWindowAndWait(panels[6]->browser()); |
| 432 num_overflow_panels--; | 450 num_overflow_panels--; |
| 433 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 451 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| 434 panel_manager->num_panels()); | 452 panel_manager->num_panels()); |
| 435 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 453 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 436 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 454 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 437 | 455 |
| 438 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 456 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 439 | 457 |
| 440 expected_overflow_list.clear(); | 458 expected_overflow_list.clear(); |
| 441 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 459 expected_overflow_list.Add(panels[3], true, false); |
| 442 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 460 expected_overflow_list.Add(panels[4], true, false); |
| 443 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 461 expected_overflow_list.Add(panels[5], true, false); |
| 444 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 462 expected_overflow_list.Add(panels[7], false, false); |
| 445 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 463 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 446 | 464 |
| 447 // Close an overflow panel. Expect an overflow-on-overflow panel to become | 465 // Close an overflow panel. Expect an overflow-on-overflow panel to become |
| 448 // visible in the overflow strip. | 466 // visible in the overflow strip. |
| 449 // normal: P0, P1, P2 | 467 // normal: P0, P1, P2 |
| 450 // overflow: P3, P5, P7 | 468 // overflow: P3, P5, P7 |
| 451 CloseWindowAndWait(panels[4]->browser()); | 469 CloseWindowAndWait(panels[4]->browser()); |
| 452 num_overflow_panels--; | 470 num_overflow_panels--; |
| 453 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 471 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| 454 panel_manager->num_panels()); | 472 panel_manager->num_panels()); |
| 455 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 473 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 456 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 474 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 457 | 475 |
| 458 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 476 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 459 | 477 |
| 460 expected_overflow_list.clear(); | 478 expected_overflow_list.clear(); |
| 461 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 479 expected_overflow_list.Add(panels[3], true, false); |
| 462 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 480 expected_overflow_list.Add(panels[5], true, false); |
| 463 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, true, false); | 481 expected_overflow_list.Add(panels[7], true, false); |
| 464 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 482 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 465 | 483 |
| 466 // Close an overflow panel. Expect only that panel is closed. | 484 // Close an overflow panel. Expect only that panel is closed. |
| 467 // normal: P0, P1, P2 | 485 // normal: P0, P1, P2 |
| 468 // overflow: P5, P7 | 486 // overflow: P5, P7 |
| 469 CloseWindowAndWait(panels[3]->browser()); | 487 CloseWindowAndWait(panels[3]->browser()); |
| 470 num_overflow_panels--; | 488 num_overflow_panels--; |
| 471 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 489 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| 472 panel_manager->num_panels()); | 490 panel_manager->num_panels()); |
| 473 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 491 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 474 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 492 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 475 | 493 |
| 476 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 494 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 477 | 495 |
| 478 expected_overflow_list.clear(); | 496 expected_overflow_list.clear(); |
| 479 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 497 expected_overflow_list.Add(panels[5], true, false); |
| 480 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, true, false); | 498 expected_overflow_list.Add(panels[7], true, false); |
| 481 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 499 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 482 | 500 |
| 483 panel_manager->RemoveAll(); | 501 panel_manager->RemoveAll(); |
| 484 } | 502 } |
| 485 | 503 |
| 486 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CloseNormalPanels) { | 504 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CloseNormalPanels) { |
| 487 PanelManager* panel_manager = PanelManager::GetInstance(); | 505 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 488 PanelStrip* panel_strip = panel_manager->panel_strip(); | 506 PanelStrip* panel_strip = panel_manager->panel_strip(); |
| 489 PanelOverflowStrip* panel_overflow_strip = | 507 PanelOverflowStrip* panel_overflow_strip = |
| 490 panel_manager->panel_overflow_strip(); | 508 panel_manager->panel_overflow_strip(); |
| 491 | 509 |
| 492 // Create normal and overflow panels. | 510 // Create normal and overflow panels. |
| 493 // normal: P0, P1, P2 | 511 // normal: P0, P1, P2 |
| 494 // overflow: P3, P4, P5 | 512 // overflow: P3, P4, P5 |
| 495 // overflow-on-overflow: P6, P7, P8 | 513 // overflow-on-overflow: P6, P7, P8 |
| 496 int num_normal_panels = 3; | 514 int num_normal_panels = 3; |
| 497 int num_overflow_panels = 6; | 515 int num_overflow_panels = 6; |
| 498 const int panel_widths[] = { | 516 const int panel_widths[] = { |
| 499 260, 250, 200, // normal | 517 260, 250, 200, // normal |
| 500 255, 260, 120, // overflow | 518 255, 260, 120, // overflow |
| 501 240, 210, 258 // overflow-on-overflow | 519 240, 210, 258 // overflow-on-overflow |
| 502 }; | 520 }; |
| 503 std::vector<Panel*> panels = CreateOverflowPanels( | 521 std::vector<Panel*> panels = CreateOverflowPanels( |
| 504 num_normal_panels, num_overflow_panels, panel_widths); | 522 num_normal_panels, num_overflow_panels, panel_widths); |
| 505 | 523 |
| 506 PanelDataList expected_normal_list; | 524 NormalPanelDataList expected_normal_list; |
| 507 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 525 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 508 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 526 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 509 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 527 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 510 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 528 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 511 | 529 |
| 512 PanelDataList expected_overflow_list; | 530 OverflowPanelDataList expected_overflow_list; |
| 513 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 531 expected_overflow_list.Add(panels[3], true, false); |
| 514 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 532 expected_overflow_list.Add(panels[4], true, false); |
| 515 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 533 expected_overflow_list.Add(panels[5], true, false); |
| 516 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, false, false); | 534 expected_overflow_list.Add(panels[6], false, false); |
| 517 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 535 expected_overflow_list.Add(panels[7], false, false); |
| 518 expected_overflow_list.Add(panels[8], Panel::IN_OVERFLOW, false, false); | 536 expected_overflow_list.Add(panels[8], false, false); |
| 519 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 537 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 520 | 538 |
| 521 // Close a normal panel. Expect an overflow panel to move over and an | 539 // Close a normal panel. Expect an overflow panel to move over and an |
| 522 // overflow-on-overflow panel to become visible. | 540 // overflow-on-overflow panel to become visible. |
| 523 // normal: P0, P2, P3 | 541 // normal: P0, P2, P3 |
| 524 // overflow: P4, P5, P6 | 542 // overflow: P4, P5, P6 |
| 525 // overflow-on-overflow: P7, P8 | 543 // overflow-on-overflow: P7, P8 |
| 526 CloseWindowAndWait(panels[1]->browser()); | 544 CloseWindowAndWait(panels[1]->browser()); |
| 527 num_overflow_panels--; | 545 num_overflow_panels--; |
| 528 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 546 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| 529 panel_manager->num_panels()); | 547 panel_manager->num_panels()); |
| 530 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 548 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 531 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 549 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 532 | 550 |
| 533 expected_normal_list.clear(); | 551 expected_normal_list.clear(); |
| 534 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 552 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 535 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 553 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 536 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, false); | 554 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, false); |
| 537 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 555 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 538 | 556 |
| 539 expected_overflow_list.clear(); | 557 expected_overflow_list.clear(); |
| 540 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 558 expected_overflow_list.Add(panels[4], true, false); |
| 541 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 559 expected_overflow_list.Add(panels[5], true, false); |
| 542 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, true, false); | 560 expected_overflow_list.Add(panels[6], true, false); |
| 543 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 561 expected_overflow_list.Add(panels[7], false, false); |
| 544 expected_overflow_list.Add(panels[8], Panel::IN_OVERFLOW, false, false); | 562 expected_overflow_list.Add(panels[8], false, false); |
| 545 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 563 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 546 | 564 |
| 547 // Close another normal panel. Remaining overflow panels cannot move over | 565 // Close another normal panel. Remaining overflow panels cannot move over |
| 548 // due to not enough room. | 566 // due to not enough room. |
| 549 // normal: P0, P3 | 567 // normal: P0, P3 |
| 550 // overflow: P4, P5, P6 | 568 // overflow: P4, P5, P6 |
| 551 // overflow-on-overflow: P7, P8 | 569 // overflow-on-overflow: P7, P8 |
| 552 CloseWindowAndWait(panels[2]->browser()); | 570 CloseWindowAndWait(panels[2]->browser()); |
| 553 num_normal_panels--; | 571 num_normal_panels--; |
| 554 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 572 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 575 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 593 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 576 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 594 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 577 | 595 |
| 578 expected_normal_list.clear(); | 596 expected_normal_list.clear(); |
| 579 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 597 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 580 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, false); | 598 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, false); |
| 581 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, false); | 599 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, false); |
| 582 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 600 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 583 | 601 |
| 584 expected_overflow_list.clear(); | 602 expected_overflow_list.clear(); |
| 585 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, true, false); | 603 expected_overflow_list.Add(panels[6], true, false); |
| 586 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, true, false); | 604 expected_overflow_list.Add(panels[7], true, false); |
| 587 expected_overflow_list.Add(panels[8], Panel::IN_OVERFLOW, true, false); | 605 expected_overflow_list.Add(panels[8], true, false); |
| 588 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 606 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 589 | 607 |
| 590 // Close another normal panel. Expect one overflow panel to move over. | 608 // Close another normal panel. Expect one overflow panel to move over. |
| 591 // normal: P4, P5, P6 | 609 // normal: P4, P5, P6 |
| 592 // overflow: P7, P8 | 610 // overflow: P7, P8 |
| 593 CloseWindowAndWait(panels[0]->browser()); | 611 CloseWindowAndWait(panels[0]->browser()); |
| 594 num_overflow_panels--; | 612 num_overflow_panels--; |
| 595 ASSERT_EQ(num_normal_panels + num_overflow_panels, | 613 ASSERT_EQ(num_normal_panels + num_overflow_panels, |
| 596 panel_manager->num_panels()); | 614 panel_manager->num_panels()); |
| 597 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); | 615 EXPECT_EQ(num_normal_panels, panel_strip->num_panels()); |
| 598 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); | 616 EXPECT_EQ(num_overflow_panels, panel_overflow_strip->num_panels()); |
| 599 | 617 |
| 600 expected_normal_list.clear(); | 618 expected_normal_list.clear(); |
| 601 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, false); | 619 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, false); |
| 602 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, false); | 620 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, false); |
| 603 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, false); | 621 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, false); |
| 604 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 622 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 605 | 623 |
| 606 expected_overflow_list.clear(); | 624 expected_overflow_list.clear(); |
| 607 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, true, false); | 625 expected_overflow_list.Add(panels[7], true, false); |
| 608 expected_overflow_list.Add(panels[8], Panel::IN_OVERFLOW, true, false); | 626 expected_overflow_list.Add(panels[8], true, false); |
| 609 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 627 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 610 | 628 |
| 611 panel_manager->RemoveAll(); | 629 panel_manager->RemoveAll(); |
| 612 } | 630 } |
| 613 | 631 |
| 614 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 632 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
| 615 MAYBE_CloseWithDelayedOverflow) { | 633 MAYBE_CloseWithDelayedOverflow) { |
| 616 PanelManager* panel_manager = PanelManager::GetInstance(); | 634 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 617 PanelStrip* panel_strip = panel_manager->panel_strip(); | 635 PanelStrip* panel_strip = panel_manager->panel_strip(); |
| 618 | 636 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 645 // panel will not be affected by the close. | 663 // panel will not be affected by the close. |
| 646 // Hack. Pretend to close panel by removing it directly. Cannot use | 664 // Hack. Pretend to close panel by removing it directly. Cannot use |
| 647 // CloseWindowAndWait() here because it will allow the delayed overflow | 665 // CloseWindowAndWait() here because it will allow the delayed overflow |
| 648 // to complete. | 666 // to complete. |
| 649 panel_strip->Remove(panel1); | 667 panel_strip->Remove(panel1); |
| 650 EXPECT_EQ(1, panel_strip->num_panels()); | 668 EXPECT_EQ(1, panel_strip->num_panels()); |
| 651 EXPECT_EQ(1, panel_strip->num_temporary_layout_panels()); | 669 EXPECT_EQ(1, panel_strip->num_temporary_layout_panels()); |
| 652 EXPECT_TRUE(overflow_panel->has_temporary_layout()); | 670 EXPECT_TRUE(overflow_panel->has_temporary_layout()); |
| 653 | 671 |
| 654 // Make sure the overflow panel actually moves to overflow. | 672 // Make sure the overflow panel actually moves to overflow. |
| 655 WaitForExpansionStateChanged(overflow_panel, Panel::IN_OVERFLOW); | 673 WaitForStripOwnerChanged(overflow_panel, Panel::IN_OVERFLOW); |
| 656 EXPECT_EQ(0, panel_strip->num_temporary_layout_panels()); | 674 EXPECT_EQ(0, panel_strip->num_temporary_layout_panels()); |
| 657 | 675 |
| 658 // Hack. Put the "falsely closed" panel back into the panel strip | 676 // Hack. Put the "falsely closed" panel back into the panel strip |
| 659 // so we can properly close it to wrap up this test. | 677 // so we can properly close it to wrap up this test. |
| 660 panel_strip->AddPanel(panel1); | 678 panel_strip->AddPanel(panel1); |
| 661 | 679 |
| 662 panel0->Close(); | 680 panel0->Close(); |
| 663 panel1->Close(); | 681 panel1->Close(); |
| 664 overflow_panel->Close(); | 682 overflow_panel->Close(); |
| 665 } | 683 } |
| 666 | 684 |
| 667 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_ActivateOverflowPanels) { | 685 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_ActivateOverflowPanels) { |
| 668 // Create normal and overflow panels. | 686 // Create normal and overflow panels. |
| 669 // normal: P0, P1, P2 | 687 // normal: P0, P1, P2 |
| 670 // overflow: P3, P4, P5 | 688 // overflow: P3, P4, P5 |
| 671 // overflow-on-overflow: P6, P7 | 689 // overflow-on-overflow: P6, P7 |
| 672 const int panel_widths[] = { | 690 const int panel_widths[] = { |
| 673 250, 260, 200, // normal | 691 250, 260, 200, // normal |
| 674 210, 260, 230, // overflow | 692 210, 260, 230, // overflow |
| 675 255, 210 // overflow-on-overflow | 693 255, 210 // overflow-on-overflow |
| 676 }; | 694 }; |
| 677 std::vector<Panel*> panels = CreateOverflowPanels(3, 5, panel_widths); | 695 std::vector<Panel*> panels = CreateOverflowPanels(3, 5, panel_widths); |
| 678 | 696 |
| 679 PanelDataList expected_normal_list; | 697 NormalPanelDataList expected_normal_list; |
| 680 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 698 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 681 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 699 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 682 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 700 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 683 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 701 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 684 | 702 |
| 685 PanelDataList expected_overflow_list; | 703 OverflowPanelDataList expected_overflow_list; |
| 686 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 704 expected_overflow_list.Add(panels[3], true, false); |
| 687 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 705 expected_overflow_list.Add(panels[4], true, false); |
| 688 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 706 expected_overflow_list.Add(panels[5], true, false); |
| 689 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, false, false); | 707 expected_overflow_list.Add(panels[6], false, false); |
| 690 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 708 expected_overflow_list.Add(panels[7], false, false); |
| 691 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 709 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 692 | 710 |
| 693 // Activate an overflow panel. Expect one normal panel is swapped into the | 711 // Activate an overflow panel. Expect one normal panel is swapped into the |
| 694 // overflow strip. | 712 // overflow strip. |
| 695 // normal: P0, P1, P3 | 713 // normal: P0, P1, P3 |
| 696 // overflow: P2, P4, P5 | 714 // overflow: P2, P4, P5 |
| 697 // overflow-on-overflow: P6, P7 | 715 // overflow-on-overflow: P6, P7 |
| 698 panels[3]->Activate(); | 716 panels[3]->Activate(); |
| 699 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); | 717 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); |
| 700 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); | 718 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); |
| 701 | 719 |
| 702 expected_normal_list.clear(); | 720 expected_normal_list.clear(); |
| 703 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 721 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 704 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 722 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 705 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); | 723 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); |
| 706 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 724 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 707 | 725 |
| 708 expected_overflow_list.clear(); | 726 expected_overflow_list.clear(); |
| 709 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 727 expected_overflow_list.Add(panels[2], true, false); |
| 710 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 728 expected_overflow_list.Add(panels[4], true, false); |
| 711 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 729 expected_overflow_list.Add(panels[5], true, false); |
| 712 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, false, false); | 730 expected_overflow_list.Add(panels[6], false, false); |
| 713 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 731 expected_overflow_list.Add(panels[7], false, false); |
| 714 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 732 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 715 | 733 |
| 716 // Activate an overflow panel. Expect two normal panels are swapped into the | 734 // Activate an overflow panel. Expect two normal panels are swapped into the |
| 717 // overflow strip and one overflow panel to become hidden. | 735 // overflow strip and one overflow panel to become hidden. |
| 718 // normal: P0, P4 | 736 // normal: P0, P4 |
| 719 // overflow: P1, P3, P2 | 737 // overflow: P1, P3, P2 |
| 720 // overflow-on-overflow: P5, P6, P7 | 738 // overflow-on-overflow: P5, P6, P7 |
| 721 panels[4]->Activate(); | 739 panels[4]->Activate(); |
| 722 WaitForPanelActiveState(panels[4], SHOW_AS_ACTIVE); | 740 WaitForPanelActiveState(panels[4], SHOW_AS_ACTIVE); |
| 723 WaitForExpansionStateChanged(panels[4], Panel::EXPANDED); | 741 WaitForExpansionStateChanged(panels[4], Panel::EXPANDED); |
| 724 WaitForPanelActiveState(panels[3], SHOW_AS_INACTIVE); | 742 WaitForPanelActiveState(panels[3], SHOW_AS_INACTIVE); |
| 725 | 743 |
| 726 expected_normal_list.clear(); | 744 expected_normal_list.clear(); |
| 727 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 745 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 728 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, true); | 746 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, true); |
| 729 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 747 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 730 | 748 |
| 731 expected_overflow_list.clear(); | 749 expected_overflow_list.clear(); |
| 732 expected_overflow_list.Add(panels[1], Panel::IN_OVERFLOW, true, false); | 750 expected_overflow_list.Add(panels[1], true, false); |
| 733 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 751 expected_overflow_list.Add(panels[3], true, false); |
| 734 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 752 expected_overflow_list.Add(panels[2], true, false); |
| 735 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, false, false); | 753 expected_overflow_list.Add(panels[5], false, false); |
| 736 expected_overflow_list.Add(panels[6], Panel::IN_OVERFLOW, false, false); | 754 expected_overflow_list.Add(panels[6], false, false); |
| 737 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 755 expected_overflow_list.Add(panels[7], false, false); |
| 738 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 756 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 739 | 757 |
| 740 // Activate an overflow-on-overflow panel. Expect one normal panel is swapped | 758 // Activate an overflow-on-overflow panel. Expect one normal panel is swapped |
| 741 // into the overflow strip. | 759 // into the overflow strip. |
| 742 // normal: P0, P6 | 760 // normal: P0, P6 |
| 743 // overflow: P4, P1, P3, | 761 // overflow: P4, P1, P3, |
| 744 // overflow-on-overflow: P2, P5, P7 | 762 // overflow-on-overflow: P2, P5, P7 |
| 745 panels[6]->Activate(); | 763 panels[6]->Activate(); |
| 746 WaitForPanelActiveState(panels[6], SHOW_AS_ACTIVE); | 764 WaitForPanelActiveState(panels[6], SHOW_AS_ACTIVE); |
| 747 WaitForExpansionStateChanged(panels[6], Panel::EXPANDED); | 765 WaitForExpansionStateChanged(panels[6], Panel::EXPANDED); |
| 748 WaitForPanelActiveState(panels[4], SHOW_AS_INACTIVE); | 766 WaitForPanelActiveState(panels[4], SHOW_AS_INACTIVE); |
| 749 | 767 |
| 750 expected_normal_list.clear(); | 768 expected_normal_list.clear(); |
| 751 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 769 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 752 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, true); | 770 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, true); |
| 753 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 771 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 754 | 772 |
| 755 expected_overflow_list.clear(); | 773 expected_overflow_list.clear(); |
| 756 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 774 expected_overflow_list.Add(panels[4], true, false); |
| 757 expected_overflow_list.Add(panels[1], Panel::IN_OVERFLOW, true, false); | 775 expected_overflow_list.Add(panels[1], true, false); |
| 758 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 776 expected_overflow_list.Add(panels[3], true, false); |
| 759 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, false, false); | 777 expected_overflow_list.Add(panels[2], false, false); |
| 760 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, false, false); | 778 expected_overflow_list.Add(panels[5], false, false); |
| 761 expected_overflow_list.Add(panels[7], Panel::IN_OVERFLOW, false, false); | 779 expected_overflow_list.Add(panels[7], false, false); |
| 762 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 780 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 763 | 781 |
| 764 // Activate an overflow-on-overflow panel. No normal panel is swapped | 782 // Activate an overflow-on-overflow panel. No normal panel is swapped |
| 765 // since there has already been enough space in the panel strip. | 783 // since there has already been enough space in the panel strip. |
| 766 // normal: P0, P6, P7 | 784 // normal: P0, P6, P7 |
| 767 // overflow: P4, P1, P3, | 785 // overflow: P4, P1, P3, |
| 768 // overflow-on-overflow: P2, P5 | 786 // overflow-on-overflow: P2, P5 |
| 769 panels[7]->Activate(); | 787 panels[7]->Activate(); |
| 770 WaitForPanelActiveState(panels[7], SHOW_AS_ACTIVE); | 788 WaitForPanelActiveState(panels[7], SHOW_AS_ACTIVE); |
| 771 WaitForExpansionStateChanged(panels[7], Panel::EXPANDED); | 789 WaitForExpansionStateChanged(panels[7], Panel::EXPANDED); |
| 772 WaitForPanelActiveState(panels[6], SHOW_AS_INACTIVE); | 790 WaitForPanelActiveState(panels[6], SHOW_AS_INACTIVE); |
| 773 | 791 |
| 774 expected_normal_list.clear(); | 792 expected_normal_list.clear(); |
| 775 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 793 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 776 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, false); | 794 expected_normal_list.Add(panels[6], Panel::EXPANDED, true, false); |
| 777 expected_normal_list.Add(panels[7], Panel::EXPANDED, true, true); | 795 expected_normal_list.Add(panels[7], Panel::EXPANDED, true, true); |
| 778 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 796 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 779 | 797 |
| 780 expected_overflow_list.clear(); | 798 expected_overflow_list.clear(); |
| 781 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 799 expected_overflow_list.Add(panels[4], true, false); |
| 782 expected_overflow_list.Add(panels[1], Panel::IN_OVERFLOW, true, false); | 800 expected_overflow_list.Add(panels[1], true, false); |
| 783 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 801 expected_overflow_list.Add(panels[3], true, false); |
| 784 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, false, false); | 802 expected_overflow_list.Add(panels[2], false, false); |
| 785 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, false, false); | 803 expected_overflow_list.Add(panels[5], false, false); |
| 786 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 804 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 787 | 805 |
| 788 PanelManager::GetInstance()->RemoveAll(); | 806 PanelManager::GetInstance()->RemoveAll(); |
| 789 } | 807 } |
| 790 | 808 |
| 791 IN_PROC_BROWSER_TEST_F( | 809 IN_PROC_BROWSER_TEST_F( |
| 792 PanelOverflowBrowserTest, | 810 PanelOverflowBrowserTest, |
| 793 MAYBE_MoveMinimizedPanelToOverflowAndBringBackByActivate) { | 811 MAYBE_MoveMinimizedPanelToOverflowAndBringBackByActivate) { |
| 794 // Create normal and overflow panels. | 812 // Create normal and overflow panels. |
| 795 // normal: P0, P1, P2 | 813 // normal: P0, P1, P2 |
| 796 // overflow: P3, P4 | 814 // overflow: P3, P4 |
| 797 const int panel_widths[] = { | 815 const int panel_widths[] = { |
| 798 250, 260, 200, // normal | 816 250, 260, 200, // normal |
| 799 210, 260 // overflow | 817 210, 260 // overflow |
| 800 }; | 818 }; |
| 801 std::vector<Panel*> panels = CreateOverflowPanels(3, 2, panel_widths); | 819 std::vector<Panel*> panels = CreateOverflowPanels(3, 2, panel_widths); |
| 802 | 820 |
| 803 PanelDataList expected_normal_list; | 821 NormalPanelDataList expected_normal_list; |
| 804 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 822 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 805 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 823 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 806 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 824 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 807 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 825 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 808 | 826 |
| 809 PanelDataList expected_overflow_list; | 827 OverflowPanelDataList expected_overflow_list; |
| 810 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 828 expected_overflow_list.Add(panels[3], true, false); |
| 811 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 829 expected_overflow_list.Add(panels[4], true, false); |
| 812 | 830 |
| 813 // Minimize a normal panel and then bump it to overflow by activating an | 831 // Minimize a normal panel and then bump it to overflow by activating an |
| 814 // overflow panel. | 832 // overflow panel. |
| 815 // normal: P0, P1, P3 | 833 // normal: P0, P1, P3 |
| 816 // overflow: P2, P4 | 834 // overflow: P2, P4 |
| 817 panels[2]->SetExpansionState(Panel::MINIMIZED); | 835 panels[2]->SetExpansionState(Panel::MINIMIZED); |
| 818 panels[3]->Activate(); | 836 panels[3]->Activate(); |
| 819 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); | 837 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); |
| 820 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); | 838 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); |
| 821 | 839 |
| 822 expected_normal_list.clear(); | 840 expected_normal_list.clear(); |
| 823 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 841 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 824 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 842 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 825 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); | 843 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); |
| 826 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 844 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 827 | 845 |
| 828 expected_overflow_list.clear(); | 846 expected_overflow_list.clear(); |
| 829 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 847 expected_overflow_list.Add(panels[2], true, false); |
| 830 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 848 expected_overflow_list.Add(panels[4], true, false); |
| 831 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 849 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 832 | 850 |
| 833 // Reactivate the formerly minimized panel. It will return to the panel | 851 // Reactivate the formerly minimized panel. It will return to the panel |
| 834 // strip in expanded state. | 852 // strip in expanded state. |
| 835 // normal: P0, P1, P2 | 853 // normal: P0, P1, P2 |
| 836 // overflow: P3, P4 | 854 // overflow: P3, P4 |
| 837 panels[2]->Activate(); | 855 panels[2]->Activate(); |
| 838 WaitForPanelActiveState(panels[2], SHOW_AS_ACTIVE); | 856 WaitForPanelActiveState(panels[2], SHOW_AS_ACTIVE); |
| 839 WaitForExpansionStateChanged(panels[2], Panel::EXPANDED); | 857 WaitForExpansionStateChanged(panels[2], Panel::EXPANDED); |
| 840 | 858 |
| 841 expected_normal_list.clear(); | 859 expected_normal_list.clear(); |
| 842 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 860 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 843 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 861 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 844 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, true); | 862 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, true); |
| 845 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 863 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 846 | 864 |
| 847 expected_overflow_list.clear(); | 865 expected_overflow_list.clear(); |
| 848 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 866 expected_overflow_list.Add(panels[3], true, false); |
| 849 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 867 expected_overflow_list.Add(panels[4], true, false); |
| 850 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 868 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 851 | 869 |
| 852 // Minimize a panel to title only mode, then bump it to overflow. | 870 // Minimize a panel to title only mode, then bump it to overflow. |
| 853 // normal: P0, P1, P3 | 871 // normal: P0, P1, P3 |
| 854 // overflow: P2, P4 | 872 // overflow: P2, P4 |
| 855 panels[2]->SetExpansionState(Panel::TITLE_ONLY); | 873 panels[2]->SetExpansionState(Panel::TITLE_ONLY); |
| 856 panels[3]->Activate(); | 874 panels[3]->Activate(); |
| 857 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); | 875 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); |
| 858 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); | 876 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); |
| 859 | 877 |
| 860 expected_normal_list.clear(); | 878 expected_normal_list.clear(); |
| 861 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 879 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 862 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 880 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 863 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); | 881 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); |
| 864 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 882 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 865 | 883 |
| 866 expected_overflow_list.clear(); | 884 expected_overflow_list.clear(); |
| 867 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 885 expected_overflow_list.Add(panels[2], true, false); |
| 868 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 886 expected_overflow_list.Add(panels[4], true, false); |
| 869 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 887 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 870 | 888 |
| 871 // Reactivate the formerly minimized panel. It will return to the panel | 889 // Reactivate the formerly minimized panel. It will return to the panel |
| 872 // strip in expanded state. | 890 // strip in expanded state. |
| 873 // normal: P0, P1, P2 | 891 // normal: P0, P1, P2 |
| 874 // overflow: P3, P4 | 892 // overflow: P3, P4 |
| 875 panels[2]->Activate(); | 893 panels[2]->Activate(); |
| 876 WaitForPanelActiveState(panels[2], SHOW_AS_ACTIVE); | 894 WaitForPanelActiveState(panels[2], SHOW_AS_ACTIVE); |
| 877 WaitForExpansionStateChanged(panels[2], Panel::EXPANDED); | 895 WaitForExpansionStateChanged(panels[2], Panel::EXPANDED); |
| 878 | 896 |
| 879 expected_normal_list.clear(); | 897 expected_normal_list.clear(); |
| 880 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 898 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 881 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 899 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 882 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, true); | 900 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, true); |
| 883 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 901 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 884 | 902 |
| 885 expected_overflow_list.clear(); | 903 expected_overflow_list.clear(); |
| 886 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 904 expected_overflow_list.Add(panels[3], true, false); |
| 887 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 905 expected_overflow_list.Add(panels[4], true, false); |
| 888 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 906 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 889 | 907 |
| 890 PanelManager::GetInstance()->RemoveAll(); | 908 PanelManager::GetInstance()->RemoveAll(); |
| 891 } | 909 } |
| 892 | 910 |
| 893 IN_PROC_BROWSER_TEST_F( | 911 IN_PROC_BROWSER_TEST_F( |
| 894 PanelOverflowBrowserTest, | 912 PanelOverflowBrowserTest, |
| 895 MAYBE_MoveMinimizedPanelToOverflowAndBringBackByCloseOrResize) { | 913 MAYBE_MoveMinimizedPanelToOverflowAndBringBackByCloseOrResize) { |
| 896 PanelManager* panel_manager = PanelManager::GetInstance(); | 914 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 897 | 915 |
| 898 // Create normal and overflow panels. | 916 // Create normal and overflow panels. |
| 899 // normal: P0, P1, P2 | 917 // normal: P0, P1, P2 |
| 900 // overflow: P3, P4, P5 | 918 // overflow: P3, P4, P5 |
| 901 const int panel_widths[] = { | 919 const int panel_widths[] = { |
| 902 240, 240, 120, // normal | 920 240, 240, 120, // normal |
| 903 240, 240, 240 // overflow | 921 240, 240, 240 // overflow |
| 904 }; | 922 }; |
| 905 std::vector<Panel*> panels = CreateOverflowPanels(3, 3, panel_widths); | 923 std::vector<Panel*> panels = CreateOverflowPanels(3, 3, panel_widths); |
| 906 | 924 |
| 907 PanelDataList expected_normal_list; | 925 NormalPanelDataList expected_normal_list; |
| 908 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 926 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 909 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 927 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 910 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); | 928 expected_normal_list.Add(panels[2], Panel::EXPANDED, true, false); |
| 911 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 929 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 912 | 930 |
| 913 PanelDataList expected_overflow_list; | 931 OverflowPanelDataList expected_overflow_list; |
| 914 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); | 932 expected_overflow_list.Add(panels[3], true, false); |
| 915 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 933 expected_overflow_list.Add(panels[4], true, false); |
| 916 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 934 expected_overflow_list.Add(panels[5], true, false); |
| 917 | 935 |
| 918 // Test case 1: restoring minimized to minimized. | 936 // Test case 1: restoring minimized to minimized. |
| 919 { | 937 { |
| 920 // Minimize a normal panel and then bump it to overflow by activating an | 938 // Minimize a normal panel and then bump it to overflow by activating an |
| 921 // overflow panel. | 939 // overflow panel. |
| 922 // normal: P0, P1, P3 | 940 // normal: P0, P1, P3 |
| 923 // overflow: P2, P4, P5 | 941 // overflow: P2, P4, P5 |
| 924 panels[2]->SetExpansionState(Panel::MINIMIZED); | 942 panels[2]->SetExpansionState(Panel::MINIMIZED); |
| 925 panels[3]->Activate(); | 943 panels[3]->Activate(); |
| 926 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); | 944 WaitForPanelActiveState(panels[3], SHOW_AS_ACTIVE); |
| 927 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); | 945 WaitForExpansionStateChanged(panels[3], Panel::EXPANDED); |
| 928 | 946 |
| 929 expected_normal_list.clear(); | 947 expected_normal_list.clear(); |
| 930 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 948 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 931 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 949 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 932 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); | 950 expected_normal_list.Add(panels[3], Panel::EXPANDED, true, true); |
| 933 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 951 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 934 | 952 |
| 935 expected_overflow_list.clear(); | 953 expected_overflow_list.clear(); |
| 936 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 954 expected_overflow_list.Add(panels[2], true, false); |
| 937 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 955 expected_overflow_list.Add(panels[4], true, false); |
| 938 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 956 expected_overflow_list.Add(panels[5], true, false); |
| 939 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 957 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 940 | 958 |
| 941 // Bring back the formerly minimized panel by closing a panel. It will | 959 // Bring back the formerly minimized panel by closing a panel. It will |
| 942 // return to the panel strip in the minimized state. | 960 // return to the panel strip in the minimized state. |
| 943 // normal: P0, P1, P2 | 961 // normal: P0, P1, P2 |
| 944 // overflow: P4, P5 | 962 // overflow: P4, P5 |
| 945 CloseWindowAndWait(panels[3]->browser()); | 963 CloseWindowAndWait(panels[3]->browser()); |
| 946 WaitForExpansionStateChanged(panels[2], Panel::MINIMIZED); | 964 WaitForExpansionStateChanged(panels[2], Panel::MINIMIZED); |
| 947 | 965 |
| 948 expected_normal_list.clear(); | 966 expected_normal_list.clear(); |
| 949 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 967 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 950 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 968 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 951 expected_normal_list.Add(panels[2], Panel::MINIMIZED, true, false); | 969 expected_normal_list.Add(panels[2], Panel::MINIMIZED, true, false); |
| 952 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 970 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 953 | 971 |
| 954 expected_overflow_list.clear(); | 972 expected_overflow_list.clear(); |
| 955 expected_overflow_list.Add(panels[4], Panel::IN_OVERFLOW, true, false); | 973 expected_overflow_list.Add(panels[4], true, false); |
| 956 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 974 expected_overflow_list.Add(panels[5], true, false); |
| 957 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 975 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 958 } | 976 } |
| 959 | 977 |
| 960 // Test case 2: restoring minimized to title-only. | 978 // Test case 2: restoring minimized to title-only. |
| 961 { | 979 { |
| 962 // Bump the minimized panel to overflow by activating an overflow panel. | 980 // Bump the minimized panel to overflow by activating an overflow panel. |
| 963 // normal: P0, P1, P4 | 981 // normal: P0, P1, P4 |
| 964 // overflow: P2, P5 | 982 // overflow: P2, P5 |
| 965 panels[4]->Activate(); | 983 panels[4]->Activate(); |
| 966 WaitForPanelActiveState(panels[4], SHOW_AS_ACTIVE); | 984 WaitForPanelActiveState(panels[4], SHOW_AS_ACTIVE); |
| 967 WaitForExpansionStateChanged(panels[4], Panel::EXPANDED); | 985 WaitForExpansionStateChanged(panels[4], Panel::EXPANDED); |
| 968 | 986 |
| 969 expected_normal_list.clear(); | 987 expected_normal_list.clear(); |
| 970 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); | 988 expected_normal_list.Add(panels[0], Panel::EXPANDED, true, false); |
| 971 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 989 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 972 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, true); | 990 expected_normal_list.Add(panels[4], Panel::EXPANDED, true, true); |
| 973 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 991 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 974 | 992 |
| 975 expected_overflow_list.clear(); | 993 expected_overflow_list.clear(); |
| 976 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 994 expected_overflow_list.Add(panels[2], true, false); |
| 977 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 995 expected_overflow_list.Add(panels[5], true, false); |
| 978 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 996 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 979 | 997 |
| 980 // Minimize another panel and hover the mouse over it. This should bring up | 998 // Minimize another panel and hover the mouse over it. This should bring up |
| 981 // all currently minimized panels. When a formerly minimized or title-only | 999 // all currently minimized panels. When a formerly minimized or title-only |
| 982 // panel is restored from the overflow area, it should also be title-only. | 1000 // panel is restored from the overflow area, it should also be title-only. |
| 983 panels[0]->SetExpansionState(Panel::MINIMIZED); | 1001 panels[0]->SetExpansionState(Panel::MINIMIZED); |
| 984 MoveMouse(gfx::Point(panels[0]->GetBounds().x(), | 1002 MoveMouse(gfx::Point(panels[0]->GetBounds().x(), |
| 985 panels[0]->GetBounds().y())); | 1003 panels[0]->GetBounds().y())); |
| 986 WaitForExpansionStateChanged(panels[0], Panel::TITLE_ONLY); | 1004 WaitForExpansionStateChanged(panels[0], Panel::TITLE_ONLY); |
| 987 | 1005 |
| 988 // Bring back the formerly minimized panel by closing a panel. It will | 1006 // Bring back the formerly minimized panel by closing a panel. It will |
| 989 // return to the panel strip in the title-only state. | 1007 // return to the panel strip in the title-only state. |
| 990 // normal: P0, P1, P2 | 1008 // normal: P0, P1, P2 |
| 991 // overflow: P5 | 1009 // overflow: P5 |
| 992 CloseWindowAndWait(panels[4]->browser()); | 1010 CloseWindowAndWait(panels[4]->browser()); |
| 993 WaitForExpansionStateChanged(panels[2], Panel::TITLE_ONLY); | 1011 WaitForExpansionStateChanged(panels[2], Panel::TITLE_ONLY); |
| 994 | 1012 |
| 995 expected_normal_list.clear(); | 1013 expected_normal_list.clear(); |
| 996 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); | 1014 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); |
| 997 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 1015 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 998 expected_normal_list.Add(panels[2], Panel::TITLE_ONLY, true, false); | 1016 expected_normal_list.Add(panels[2], Panel::TITLE_ONLY, true, false); |
| 999 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 1017 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 1000 | 1018 |
| 1001 expected_overflow_list.clear(); | 1019 expected_overflow_list.clear(); |
| 1002 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, true, false); | 1020 expected_overflow_list.Add(panels[5], true, false); |
| 1003 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 1021 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 1004 } | 1022 } |
| 1005 | 1023 |
| 1006 // Test case 3: restoring title-only to title-only. | 1024 // Test case 3: restoring title-only to title-only. |
| 1007 { | 1025 { |
| 1008 // Bump the title-only panel to overflow by activating an overflow panel. | 1026 // Bump the title-only panel to overflow by activating an overflow panel. |
| 1009 // normal: P0, P1, P5 | 1027 // normal: P0, P1, P5 |
| 1010 // overflow: P2 | 1028 // overflow: P2 |
| 1011 panels[5]->Activate(); | 1029 panels[5]->Activate(); |
| 1012 WaitForPanelActiveState(panels[5], SHOW_AS_ACTIVE); | 1030 WaitForPanelActiveState(panels[5], SHOW_AS_ACTIVE); |
| 1013 WaitForExpansionStateChanged(panels[5], Panel::EXPANDED); | 1031 WaitForExpansionStateChanged(panels[5], Panel::EXPANDED); |
| 1014 | 1032 |
| 1015 expected_normal_list.clear(); | 1033 expected_normal_list.clear(); |
| 1016 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); | 1034 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); |
| 1017 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 1035 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 1018 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, true); | 1036 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, true); |
| 1019 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 1037 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 1020 | 1038 |
| 1021 expected_overflow_list.clear(); | 1039 expected_overflow_list.clear(); |
| 1022 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 1040 expected_overflow_list.Add(panels[2], true, false); |
| 1023 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 1041 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 1024 | 1042 |
| 1025 // Bring back the formerly title-only panel by shrinking a panel. It will | 1043 // Bring back the formerly title-only panel by shrinking a panel. It will |
| 1026 // return to the panel strip in the title-only state. | 1044 // return to the panel strip in the title-only state. |
| 1027 // normal: P0, P1, P5, P2 | 1045 // normal: P0, P1, P5, P2 |
| 1028 panel_manager->ResizePanel(panels[5], gfx::Size( | 1046 panel_manager->ResizePanel(panels[5], gfx::Size( |
| 1029 panels[5]->GetBounds().width() / 2, | 1047 panels[5]->GetBounds().width() / 2, |
| 1030 panels[5]->GetBounds().height() / 2)); | 1048 panels[5]->GetBounds().height() / 2)); |
| 1031 | 1049 |
| 1032 expected_normal_list.clear(); | 1050 expected_normal_list.clear(); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1049 panels[5]->GetBounds().width() * 2, | 1067 panels[5]->GetBounds().width() * 2, |
| 1050 panels[5]->GetBounds().height() * 2)); | 1068 panels[5]->GetBounds().height() * 2)); |
| 1051 | 1069 |
| 1052 expected_normal_list.clear(); | 1070 expected_normal_list.clear(); |
| 1053 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); | 1071 expected_normal_list.Add(panels[0], Panel::TITLE_ONLY, true, false); |
| 1054 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); | 1072 expected_normal_list.Add(panels[1], Panel::EXPANDED, true, false); |
| 1055 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, true); | 1073 expected_normal_list.Add(panels[5], Panel::EXPANDED, true, true); |
| 1056 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); | 1074 EXPECT_EQ(expected_normal_list, GetAllNormalPanelData()); |
| 1057 | 1075 |
| 1058 expected_overflow_list.clear(); | 1076 expected_overflow_list.clear(); |
| 1059 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, true, false); | 1077 expected_overflow_list.Add(panels[2], true, false); |
| 1060 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); | 1078 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); |
| 1061 | 1079 |
| 1062 // Move the mouse away. This should bring down all currently title-only | 1080 // Move the mouse away. This should bring down all currently title-only |
| 1063 // panels. When a formerly minimized or title-only panel is restored from | 1081 // panels. When a formerly minimized or title-only panel is restored from |
| 1064 // the overflow area, it should be minimized. | 1082 // the overflow area, it should be minimized. |
| 1065 MoveMouse(gfx::Point(0, 0)); | 1083 MoveMouse(gfx::Point(0, 0)); |
| 1066 WaitForExpansionStateChanged(panels[0], Panel::MINIMIZED); | 1084 WaitForExpansionStateChanged(panels[0], Panel::MINIMIZED); |
| 1067 | 1085 |
| 1068 // Bring back the formerly title-only panel by shrinking a panel. It will | 1086 // Bring back the formerly title-only panel by shrinking a panel. It will |
| 1069 // return to the panel strip in the minimized state. | 1087 // return to the panel strip in the minimized state. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1279 EXPECT_EQ(4, panel_strip->num_panels()); | 1297 EXPECT_EQ(4, panel_strip->num_panels()); |
| 1280 EXPECT_EQ(0, overflow_strip->num_panels()); | 1298 EXPECT_EQ(0, overflow_strip->num_panels()); |
| 1281 | 1299 |
| 1282 // Resize last panel so that it is too big to fit and overflows. | 1300 // Resize last panel so that it is too big to fit and overflows. |
| 1283 // normal: P1 (250), P2 (200), P3 (100) | 1301 // normal: P1 (250), P2 (200), P3 (100) |
| 1284 // overflow: P4 (250)* | 1302 // overflow: P4 (250)* |
| 1285 gfx::Size new_size(250, 200); | 1303 gfx::Size new_size(250, 200); |
| 1286 panel_manager->OnPreferredWindowSizeChanged(panel4, new_size); | 1304 panel_manager->OnPreferredWindowSizeChanged(panel4, new_size); |
| 1287 EXPECT_EQ(3, panel_strip->num_panels()); | 1305 EXPECT_EQ(3, panel_strip->num_panels()); |
| 1288 EXPECT_EQ(1, overflow_strip->num_panels()); | 1306 EXPECT_EQ(1, overflow_strip->num_panels()); |
| 1289 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); | 1307 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); |
| 1290 EXPECT_TRUE(IsPanelInOverflowStrip(panel4)); | 1308 EXPECT_TRUE(IsPanelInOverflowStrip(panel4)); |
| 1291 EXPECT_EQ(new_size, panel4->restored_size()); | 1309 EXPECT_EQ(new_size, panel4->restored_size()); |
| 1292 | 1310 |
| 1293 // Open another panel that will fit. | 1311 // Open another panel that will fit. |
| 1294 // normal: P1 (250), P2 (200), P3 (100), P5 (100)* | 1312 // normal: P1 (250), P2 (200), P3 (100), P5 (100)* |
| 1295 // overflow: P4 (250) | 1313 // overflow: P4 (250) |
| 1296 Panel* panel5 = CreatePanelWithBounds("5", gfx::Rect(0, 0, 100, 200)); | 1314 Panel* panel5 = CreatePanelWithBounds("5", gfx::Rect(0, 0, 100, 200)); |
| 1297 EXPECT_EQ(4, panel_strip->num_panels()); | 1315 EXPECT_EQ(4, panel_strip->num_panels()); |
| 1298 EXPECT_EQ(1, overflow_strip->num_panels()); | 1316 EXPECT_EQ(1, overflow_strip->num_panels()); |
| 1299 EXPECT_EQ(Panel::EXPANDED, panel5->expansion_state()); | 1317 EXPECT_EQ(Panel::EXPANDED, panel5->expansion_state()); |
| 1300 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); // no change | 1318 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); // no change |
| 1301 | 1319 |
| 1302 // Resize a panel from the middle of the strip so that it causes a | 1320 // Resize a panel from the middle of the strip so that it causes a |
| 1303 // panel to overflow. | 1321 // panel to overflow. |
| 1304 // normal: P1 (250), P2 (200), P3 (250)* | 1322 // normal: P1 (250), P2 (200), P3 (250)* |
| 1305 // overflow: P5 (100), P4 (250) | 1323 // overflow: P5 (100), P4 (250) |
| 1306 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(250, 200)); | 1324 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(250, 200)); |
| 1307 EXPECT_EQ(3, panel_strip->num_panels()); | 1325 EXPECT_EQ(3, panel_strip->num_panels()); |
| 1308 EXPECT_EQ(2, overflow_strip->num_panels()); | 1326 EXPECT_EQ(2, overflow_strip->num_panels()); |
| 1309 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); | 1327 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); |
| 1310 EXPECT_EQ(Panel::IN_OVERFLOW, panel5->expansion_state()); | 1328 EXPECT_EQ(Panel::IN_OVERFLOW, panel5->strip_owner()); |
| 1311 const PanelOverflowStrip::Panels& overflow = overflow_strip->panels(); | 1329 const PanelOverflowStrip::Panels& overflow = overflow_strip->panels(); |
| 1312 EXPECT_EQ(panel5, overflow[0]); // new overflow panel is first | 1330 EXPECT_EQ(panel5, overflow[0]); // new overflow panel is first |
| 1313 EXPECT_EQ(panel4, overflow[1]); | 1331 EXPECT_EQ(panel4, overflow[1]); |
| 1314 | 1332 |
| 1315 // Resize panel smaller so that panel from overflow can fit. | 1333 // Resize panel smaller so that panel from overflow can fit. |
| 1316 // normal: P1 (250), P2 (200), P3 (100)*, P5 (100) | 1334 // normal: P1 (250), P2 (200), P3 (100)*, P5 (100) |
| 1317 // overflow: P4 (250) | 1335 // overflow: P4 (250) |
| 1318 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(100, 200)); | 1336 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(100, 200)); |
| 1319 EXPECT_EQ(4, panel_strip->num_panels()); | 1337 EXPECT_EQ(4, panel_strip->num_panels()); |
| 1320 EXPECT_EQ(1, overflow_strip->num_panels()); | 1338 EXPECT_EQ(1, overflow_strip->num_panels()); |
| 1321 EXPECT_EQ(Panel::EXPANDED, panel5->expansion_state()); | 1339 EXPECT_EQ(Panel::EXPANDED, panel5->expansion_state()); |
| 1322 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); | 1340 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); |
| 1323 | 1341 |
| 1324 // Resize smaller again but not small enough to fit overflow panel. | 1342 // Resize smaller again but not small enough to fit overflow panel. |
| 1325 // normal: P1 (250), P2 (100)*, P3 (100), P5 (100) | 1343 // normal: P1 (250), P2 (100)*, P3 (100), P5 (100) |
| 1326 // overflow: P4 (250) | 1344 // overflow: P4 (250) |
| 1327 panel_manager->OnPreferredWindowSizeChanged(panel2, gfx::Size(100, 200)); | 1345 panel_manager->OnPreferredWindowSizeChanged(panel2, gfx::Size(100, 200)); |
| 1328 EXPECT_EQ(4, panel_strip->num_panels()); | 1346 EXPECT_EQ(4, panel_strip->num_panels()); |
| 1329 EXPECT_EQ(1, overflow_strip->num_panels()); | 1347 EXPECT_EQ(1, overflow_strip->num_panels()); |
| 1330 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); // no change | 1348 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); // no change |
| 1331 | 1349 |
| 1332 // Resize overflow panel bigger. It should stay in overflow and bounds | 1350 // Resize overflow panel bigger. It should stay in overflow and bounds |
| 1333 // should not change. | 1351 // should not change. |
| 1334 // normal: P1 (250), P2 (100), P3 (100), P5 (100) | 1352 // normal: P1 (250), P2 (100), P3 (100), P5 (100) |
| 1335 // overflow: P4 (251)* | 1353 // overflow: P4 (251)* |
| 1336 gfx::Rect bounds_before_resize = panel4->GetBounds(); | 1354 gfx::Rect bounds_before_resize = panel4->GetBounds(); |
| 1337 new_size.SetSize(251, 200); | 1355 new_size.SetSize(251, 200); |
| 1338 panel_manager->OnPreferredWindowSizeChanged(panel4, new_size); | 1356 panel_manager->OnPreferredWindowSizeChanged(panel4, new_size); |
| 1339 EXPECT_EQ(4, panel_strip->num_panels()); | 1357 EXPECT_EQ(4, panel_strip->num_panels()); |
| 1340 EXPECT_EQ(1, overflow_strip->num_panels()); | 1358 EXPECT_EQ(1, overflow_strip->num_panels()); |
| 1341 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); | 1359 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); |
| 1342 EXPECT_EQ(bounds_before_resize, panel4->GetBounds()); | 1360 EXPECT_EQ(bounds_before_resize, panel4->GetBounds()); |
| 1343 EXPECT_EQ(new_size, panel4->restored_size()); | 1361 EXPECT_EQ(new_size, panel4->restored_size()); |
| 1344 | 1362 |
| 1345 // Resize overflow panel to make it fit. | 1363 // Resize overflow panel to make it fit. |
| 1346 // normal: P1 (250), P2 (100), P3 (100), P5 (100), P4 (100)* | 1364 // normal: P1 (250), P2 (100), P3 (100), P5 (100), P4 (100)* |
| 1347 // overflow: empty | 1365 // overflow: empty |
| 1348 panel_manager->OnPreferredWindowSizeChanged(panel4, gfx::Size(100, 200)); | 1366 panel_manager->OnPreferredWindowSizeChanged(panel4, gfx::Size(100, 200)); |
| 1349 EXPECT_EQ(5, panel_strip->num_panels()); | 1367 EXPECT_EQ(5, panel_strip->num_panels()); |
| 1350 EXPECT_EQ(0, overflow_strip->num_panels()); | 1368 EXPECT_EQ(0, overflow_strip->num_panels()); |
| 1351 EXPECT_EQ(Panel::EXPANDED, panel4->expansion_state()); | 1369 EXPECT_EQ(Panel::EXPANDED, panel4->expansion_state()); |
| 1352 | 1370 |
| 1353 // Resize a panel bigger, but not enough to cause overflow. | 1371 // Resize a panel bigger, but not enough to cause overflow. |
| 1354 // normal: P1 (250), P2 (100), P3 (150)*, P5 (100), P4 (100) | 1372 // normal: P1 (250), P2 (100), P3 (150)*, P5 (100), P4 (100) |
| 1355 // overflow: empty | 1373 // overflow: empty |
| 1356 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(150, 200)); | 1374 panel_manager->OnPreferredWindowSizeChanged(panel3, gfx::Size(150, 200)); |
| 1357 EXPECT_EQ(5, panel_strip->num_panels()); | 1375 EXPECT_EQ(5, panel_strip->num_panels()); |
| 1358 EXPECT_EQ(0, overflow_strip->num_panels()); | 1376 EXPECT_EQ(0, overflow_strip->num_panels()); |
| 1359 | 1377 |
| 1360 // Resize a panel to bump more than one panel to overflow. | 1378 // Resize a panel to bump more than one panel to overflow. |
| 1361 // normal: P1 (250), P2 (250)*, P3 (150) | 1379 // normal: P1 (250), P2 (250)*, P3 (150) |
| 1362 // overflow: P5 (100), P4 (100) | 1380 // overflow: P5 (100), P4 (100) |
| 1363 panel_manager->OnPreferredWindowSizeChanged(panel2, gfx::Size(250, 200)); | 1381 panel_manager->OnPreferredWindowSizeChanged(panel2, gfx::Size(250, 200)); |
| 1364 EXPECT_EQ(3, panel_strip->num_panels()); | 1382 EXPECT_EQ(3, panel_strip->num_panels()); |
| 1365 EXPECT_EQ(2, overflow_strip->num_panels()); | 1383 EXPECT_EQ(2, overflow_strip->num_panels()); |
| 1366 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->expansion_state()); | 1384 EXPECT_EQ(Panel::IN_OVERFLOW, panel4->strip_owner()); |
| 1367 EXPECT_EQ(Panel::IN_OVERFLOW, panel5->expansion_state()); | 1385 EXPECT_EQ(Panel::IN_OVERFLOW, panel5->strip_owner()); |
| 1368 const PanelOverflowStrip::Panels& overflow2 = overflow_strip->panels(); | 1386 const PanelOverflowStrip::Panels& overflow2 = overflow_strip->panels(); |
| 1369 EXPECT_EQ(panel5, overflow2[0]); // strip order is preserved | 1387 EXPECT_EQ(panel5, overflow2[0]); // strip order is preserved |
| 1370 EXPECT_EQ(panel4, overflow2[1]); | 1388 EXPECT_EQ(panel4, overflow2[1]); |
| 1371 | 1389 |
| 1372 panel1->Close(); | 1390 panel1->Close(); |
| 1373 panel2->Close(); | 1391 panel2->Close(); |
| 1374 panel3->Close(); | 1392 panel3->Close(); |
| 1375 panel4->Close(); | 1393 panel4->Close(); |
| 1376 panel5->Close(); | 1394 panel5->Close(); |
| 1377 } | 1395 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1395 // normal: P0, P1, P2 | 1413 // normal: P0, P1, P2 |
| 1396 // overflow: P3, P4, P5, (P6, P7, P8, P9, P10) | 1414 // overflow: P3, P4, P5, (P6, P7, P8, P9, P10) |
| 1397 // The panels enclosed in parentheses are hidden. | 1415 // The panels enclosed in parentheses are hidden. |
| 1398 int num_existing_panels = panel_manager->num_panels(); | 1416 int num_existing_panels = panel_manager->num_panels(); |
| 1399 for (int i = 0; i < 5; ++i) { | 1417 for (int i = 0; i < 5; ++i) { |
| 1400 CreatePanelParams params( | 1418 CreatePanelParams params( |
| 1401 MakePanelName(num_existing_panels + i), | 1419 MakePanelName(num_existing_panels + i), |
| 1402 gfx::Rect(0, 0, 250, 200), | 1420 gfx::Rect(0, 0, 250, 200), |
| 1403 SHOW_AS_INACTIVE); | 1421 SHOW_AS_INACTIVE); |
| 1404 Panel* panel = CreatePanelWithParams(params); | 1422 Panel* panel = CreatePanelWithParams(params); |
| 1405 WaitForExpansionStateChanged(panel, Panel::IN_OVERFLOW); | 1423 WaitForStripOwnerChanged(panel, Panel::IN_OVERFLOW); |
| 1406 EXPECT_EQ(i + 1, overflow_strip->overflow_indicator()->GetCount()); | 1424 EXPECT_EQ(i + 1, overflow_strip->overflow_indicator()->GetCount()); |
| 1407 panels.push_back(panel); | 1425 panels.push_back(panel); |
| 1408 } | 1426 } |
| 1409 | 1427 |
| 1410 // Expand the overflow area by moving mouse over it. | 1428 // Expand the overflow area by moving mouse over it. |
| 1411 // Expect the overflow indicator count gets updated. | 1429 // Expect the overflow indicator count gets updated. |
| 1412 // normal: P0, P1, P2 | 1430 // normal: P0, P1, P2 |
| 1413 // overflow: P3, P4, P5, P6, P7, P8, (P9, P10) | 1431 // overflow: P3, P4, P5, P6, P7, P8, (P9, P10) |
| 1414 MoveMouseAndWaitForOverflowAnimationEnded(panels[3]->GetBounds().origin()); | 1432 MoveMouseAndWaitForOverflowAnimationEnded(panels[3]->GetBounds().origin()); |
| 1415 EXPECT_TRUE(IsPanelVisible(panels[6])); | 1433 EXPECT_TRUE(IsPanelVisible(panels[6])); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1580 // normal: P0, P1, P5 | 1598 // normal: P0, P1, P5 |
| 1581 // overflow: P2, P10, P3, (P4, P6, P7, P9, P11) | 1599 // overflow: P2, P10, P3, (P4, P6, P7, P9, P11) |
| 1582 CloseWindowAndWait(panels[8]->browser()); | 1600 CloseWindowAndWait(panels[8]->browser()); |
| 1583 EXPECT_EQ(3, panel_strip->num_panels()); | 1601 EXPECT_EQ(3, panel_strip->num_panels()); |
| 1584 EXPECT_EQ(8, overflow_strip->num_panels()); | 1602 EXPECT_EQ(8, overflow_strip->num_panels()); |
| 1585 EXPECT_TRUE(panels[3]->IsDrawingAttention()); | 1603 EXPECT_TRUE(panels[3]->IsDrawingAttention()); |
| 1586 EXPECT_FALSE(overflow_indicator->IsDrawingAttention()); | 1604 EXPECT_FALSE(overflow_indicator->IsDrawingAttention()); |
| 1587 | 1605 |
| 1588 panel_manager->RemoveAll(); | 1606 panel_manager->RemoveAll(); |
| 1589 } | 1607 } |
| OLD | NEW |