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 // TEST FAILS WHEN THIS LINE IS UNCOMMENTED | |
jennb
2012/03/14 20:11:40
Delete these 2 lines.
| |
369 // params.wait_for_fully_created = false; | |
370 | |
371 unsigned int num_panels_to_add = 10; | |
372 unsigned int num_panels = 0; | |
373 Panel* panel7; | |
jennb
2012/03/14 20:11:40
initialize var to avoid linux compile error
| |
374 for (; num_panels < num_panels_to_add; ++num_panels) { | |
375 Panel* panel = CreatePanelWithParams(params); | |
376 if (num_panels == 7) panel7 = panel; | |
jennb
2012/03/14 20:11:40
single line style not allowed
| |
377 panel->SetExpansionState(Panel::MINIMIZED); | |
378 | |
379 panel->panel_strip()->RemovePanel(panel); | |
380 EXPECT_EQ(NULL, panel->panel_strip()); | |
381 | |
382 docked_strip->AddPanel(panel, PanelStrip::DEFAULT_POSITION); | |
383 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | |
384 } | |
jennb
2012/03/14 20:11:40
Formatting error.
| |
385 | |
386 EXPECT_EQ(num_panels, num_panels_to_add); | |
jennb
2012/03/14 20:11:40
reverse order of params
| |
387 LOG(INFO) << "Panel counts: docked strip: " << docked_strip->num_panels() << | |
jennb
2012/03/14 20:11:40
Delete before commit
| |
388 " (minimized: " << docked_strip->minimized_panel_count() << | |
389 "), temp. layout: " << | |
390 docked_strip->num_temporary_layout_panels() << | |
391 ", overflow: " << overflow_strip->num_panels(); | |
392 EXPECT_EQ(num_panels, static_cast<unsigned int> | |
393 (docked_strip->minimized_panel_count() + | |
394 docked_strip->num_temporary_layout_panels() + | |
395 overflow_strip->num_panels())); | |
396 | |
397 WaitForLayoutModeChanged(panel7, PanelStrip::IN_OVERFLOW); | |
jennb
2012/03/14 20:11:40
What is the purpose of this wait? At the end of yo
| |
398 | |
399 EXPECT_EQ(num_panels, static_cast<unsigned int> | |
400 (docked_strip->minimized_panel_count() + | |
401 docked_strip->num_temporary_layout_panels() + | |
402 overflow_strip->num_panels())); | |
403 EXPECT_EQ(0, docked_strip->num_temporary_layout_panels()); | |
jennb
2012/03/14 20:11:40
This would be true at the end of your for-loop bec
| |
404 | |
405 PanelManager::GetInstance()->CloseAll(); | |
406 } | |
407 | |
357 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, | 408 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, |
358 CreatePanelOnDelayedOverflow) { | 409 CreatePanelOnDelayedOverflow) { |
359 // Create 2 big panels. | 410 // Create 2 big panels. |
360 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); | 411 CreatePanelWithBounds("Panel0", gfx::Rect(0, 0, 260, 200)); |
361 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); | 412 CreatePanelWithBounds("Panel1", gfx::Rect(0, 0, 260, 200)); |
362 | 413 |
363 // Create an overflow panel without waiting for it to be moved to overflow. | 414 // Create an overflow panel without waiting for it to be moved to overflow. |
364 CreatePanelParams params( | 415 CreatePanelParams params( |
365 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); | 416 "Panel2", gfx::Rect(0, 0, 255, 200), SHOW_AS_INACTIVE); |
366 params.wait_for_fully_created = false; | 417 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. | 1699 // End full screen mode, expansion occurs again. |
1649 overflow_strip->OnFullScreenModeChanged(false); | 1700 overflow_strip->OnFullScreenModeChanged(false); |
1650 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); | 1701 EXPECT_TRUE(panel_manager->mouse_watcher()->IsActive()); |
1651 MoveMouse(in_overflow_area); | 1702 MoveMouse(in_overflow_area); |
1652 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); | 1703 EXPECT_GT(overflow_strip->current_display_width(), iconified_width); |
1653 MoveMouse(beyond_overflow_area); | 1704 MoveMouse(beyond_overflow_area); |
1654 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); | 1705 EXPECT_EQ(iconified_width, overflow_strip->current_display_width()); |
1655 | 1706 |
1656 panel_manager->CloseAll(); | 1707 panel_manager->CloseAll(); |
1657 } | 1708 } |
OLD | NEW |