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/docked_panel_strip.h" | 8 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
9 #include "chrome/browser/ui/panels/native_panel.h" | 9 #include "chrome/browser/ui/panels/native_panel.h" |
10 #include "chrome/browser/ui/panels/overflow_panel_strip.h" | 10 #include "chrome/browser/ui/panels/overflow_panel_strip.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[5]->panel_strip()->type()); | 347 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[5]->panel_strip()->type()); |
348 EXPECT_TRUE(IsPanelVisible(panels[5])); | 348 EXPECT_TRUE(IsPanelVisible(panels[5])); |
349 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[6]->panel_strip()->type()); | 349 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[6]->panel_strip()->type()); |
350 EXPECT_FALSE(IsPanelVisible(panels[6])); | 350 EXPECT_FALSE(IsPanelVisible(panels[6])); |
351 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[7]->panel_strip()->type()); | 351 EXPECT_EQ(PanelStrip::IN_OVERFLOW, panels[7]->panel_strip()->type()); |
352 EXPECT_FALSE(IsPanelVisible(panels[7])); | 352 EXPECT_FALSE(IsPanelVisible(panels[7])); |
353 | 353 |
354 PanelManager::GetInstance()->CloseAll(); | 354 PanelManager::GetInstance()->CloseAll(); |
355 } | 355 } |
356 | 356 |
| 357 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, AddMinimizedTillOverflow) { |
| 358 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 359 DockedPanelStrip* docked_strip = panel_manager->docked_strip(); |
| 360 OverflowPanelStrip* overflow_strip = panel_manager->overflow_strip(); |
| 361 |
| 362 EXPECT_EQ(0, panel_manager->num_panels()); |
| 363 EXPECT_EQ(0, docked_strip->num_panels()); |
| 364 EXPECT_EQ(0, overflow_strip->num_panels()); |
| 365 |
| 366 CreatePanelParams params("Test", gfx::Rect(0, 0, 100, 100), SHOW_AS_INACTIVE); |
| 367 |
| 368 // We want our panels to be uninitialized at the beginning so that |
| 369 // we test minimizing panels in temp layout and its effect on |
| 370 // the minimized panel count. |
| 371 params.wait_for_fully_created = false; |
| 372 |
| 373 unsigned int num_panels_to_add = 10; |
| 374 unsigned int num_panels = 0; |
| 375 for (; num_panels < num_panels_to_add; ++num_panels) { |
| 376 Panel* panel = CreatePanelWithParams(params); |
| 377 panel->SetExpansionState(Panel::MINIMIZED); |
| 378 |
| 379 panel->panel_strip()->RemovePanel(panel); |
| 380 EXPECT_EQ(NULL, panel->panel_strip()); |
| 381 panel->set_has_temporary_layout(false); |
| 382 |
| 383 docked_strip->AddPanel(panel, PanelStrip::DEFAULT_POSITION); |
| 384 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
| 385 EXPECT_EQ(false, panel->has_temporary_layout()); |
| 386 } |
| 387 |
| 388 EXPECT_EQ(num_panels_to_add, num_panels); |
| 389 EXPECT_EQ(0, docked_strip->num_temporary_layout_panels()); |
| 390 EXPECT_EQ(num_panels, static_cast<unsigned int> |
| 391 (docked_strip->minimized_panel_count() + |
| 392 overflow_strip->num_panels())); |
| 393 |
| 394 PanelManager::GetInstance()->CloseAll(); |
| 395 } |
| 396 |
357 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 397 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
358 CreatePanelOnDelayedOverflow) { | 398 CreatePanelOnDelayedOverflow) { |
359 // Create 2 big panels. | 399 // Create 2 big panels. |
360 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); | 400 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); |
361 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); | 401 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); |
362 | 402 |
363 // Create an overflow panel without waiting for it to be moved to overflow. | 403 // Create an overflow panel without waiting for it to be moved to overflow. |
364 CreatePanelParams params( | 404 CreatePanelParams params( |
365 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 405 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
366 params.wait_for_fully_created = false; | 406 params.wait_for_fully_created = false; |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 // End full screen mode, expansion occurs again. | 1688 // End full screen mode, expansion occurs again. |
1649 overflow_strip->OnFullScreenModeChanged(false); | 1689 overflow_strip->OnFullScreenModeChanged(false); |
1650 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); | 1690 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); |
1651 MoveMouse(in_overflow_area); | 1691 MoveMouse(in_overflow_area); |
1652 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); | 1692 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); |
1653 MoveMouse(beyond_overflow_area); | 1693 MoveMouse(beyond_overflow_area); |
1654 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); | 1694 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); |
1655 | 1695 |
1656 panel_manager->CloseAll(); | 1696 panel_manager->CloseAll(); |
1657 } | 1697 } |
OLD | NEW |