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); | |
jennb
2012/03/14 23:27:59
Add comment explaining why test does not want to w
| |
367 | |
jennb
2012/03/14 23:27:59
nit: delete blank line
| |
368 params.wait_for_fully_created = false; | |
369 | |
370 unsigned int num_panels_to_add = 10; | |
371 unsigned int num_panels = 0; | |
372 for (; num_panels < num_panels_to_add; ++num_panels) { | |
373 Panel* panel = CreatePanelWithParams(params); | |
374 panel->SetExpansionState(Panel::MINIMIZED); | |
375 | |
376 panel->panel_strip()->RemovePanel(panel); | |
377 EXPECT_EQ(NULL, panel->panel_strip()); | |
378 panel->set_has_temporary_layout(false); | |
379 | |
380 docked_strip->AddPanel(panel, PanelStrip::DEFAULT_POSITION); | |
381 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | |
382 EXPECT_EQ(false, panel->has_temporary_layout()); | |
383 } | |
384 | |
385 EXPECT_EQ(num_panels_to_add, num_panels); | |
386 EXPECT_EQ(0, docked_strip->num_temporary_layout_panels()); | |
387 EXPECT_EQ(num_panels, static_cast<unsigned int> | |
388 (docked_strip->minimized_panel_count() + | |
389 overflow_strip->num_panels())); | |
390 | |
391 PanelManager::GetInstance()->CloseAll(); | |
392 } | |
393 | |
357 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 394 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
358 CreatePanelOnDelayedOverflow) { | 395 CreatePanelOnDelayedOverflow) { |
359 // Create 2 big panels. | 396 // Create 2 big panels. |
360 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); | 397 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); |
361 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); | 398 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); |
362 | 399 |
363 // Create an overflow panel without waiting for it to be moved to overflow. | 400 // Create an overflow panel without waiting for it to be moved to overflow. |
364 CreatePanelParams params( | 401 CreatePanelParams params( |
365 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 402 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
366 params.wait_for_fully_created = false; | 403 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. | 1685 // End full screen mode, expansion occurs again. |
1649 overflow_strip->OnFullScreenModeChanged(false); | 1686 overflow_strip->OnFullScreenModeChanged(false); |
1650 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); | 1687 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); |
1651 MoveMouse(in_overflow_area); | 1688 MoveMouse(in_overflow_area); |
1652 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); | 1689 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); |
1653 MoveMouse(beyond_overflow_area); | 1690 MoveMouse(beyond_overflow_area); |
1654 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); | 1691 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); |
1655 | 1692 |
1656 panel_manager->CloseAll(); | 1693 panel_manager->CloseAll(); |
1657 } | 1694 } |
OLD | NEW |