Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Unified Diff: chrome/browser/ui/panels/old_docked_panel_browsertest.cc

Issue 10908153: [Panel refactor] Deprecate old panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux_chromeos test failure Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/old_detached_panel_browsertest.cc ('k') | chrome/browser/ui/panels/old_panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/old_docked_panel_browsertest.cc
diff --git a/chrome/browser/ui/panels/old_docked_panel_browsertest.cc b/chrome/browser/ui/panels/old_docked_panel_browsertest.cc
deleted file mode 100644
index 0f4a56a4c01c16fc441a29c0b39ef18b46eff06a..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/panels/old_docked_panel_browsertest.cc
+++ /dev/null
@@ -1,280 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/message_loop.h"
-#include "chrome/browser/ui/panels/old_base_panel_browser_test.h"
-#include "chrome/browser/ui/panels/docked_panel_strip.h"
-#include "chrome/browser/ui/panels/panel.h"
-#include "chrome/browser/ui/panels/panel_manager.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/test/test_utils.h"
-
-class OldDockedPanelBrowserTest : public OldBasePanelBrowserTest {
- public:
- virtual void SetUpOnMainThread() OVERRIDE {
- OldBasePanelBrowserTest::SetUpOnMainThread();
-
- // All the tests here assume using mocked 800x600 screen area for the
- // primary monitor. Do the check now.
- gfx::Rect primary_screen_area = PanelManager::GetInstance()->
- display_settings_provider()->GetPrimaryScreenArea();
- DCHECK(primary_screen_area.width() == 800);
- DCHECK(primary_screen_area.height() == 600);
- }
-};
-
-// TODO(jennb): timing out on Windows after r10702045 (crbug 135510)
-#if defined(OS_WIN)
-#define MAYBE_SqueezePanelsInDock DISABLED_SqueezePanelsInDock
-#else
-#define MAYBE_SqueezePanelsInDock SqueezePanelsInDock
-#endif
-IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, MAYBE_SqueezePanelsInDock) {
- PanelManager* panel_manager = PanelManager::GetInstance();
- DockedPanelStrip* docked_strip = panel_manager->docked_strip();
-
- // Create some docked panels.
- Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100));
- Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100));
- Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100));
- ASSERT_EQ(3, docked_strip->num_panels());
-
- // Check that nothing has been squeezed so far.
- EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width());
- EXPECT_EQ(panel2->GetBounds().width(), panel2->GetRestoredBounds().width());
- EXPECT_EQ(panel3->GetBounds().width(), panel3->GetRestoredBounds().width());
-
- // Create more panels so they start getting squeezed.
- Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100));
- Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100));
- Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100));
- Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100));
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel7, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // The active panel should be at full width.
- EXPECT_EQ(panel7->GetBounds().width(), panel7->GetRestoredBounds().width());
- EXPECT_GT(panel7->GetBounds().x(), docked_strip->display_area().x());
-
- // The rest of them should be at reduced width.
- EXPECT_LT(panel1->GetBounds().width(), panel1->GetRestoredBounds().width());
- EXPECT_LT(panel2->GetBounds().width(), panel2->GetRestoredBounds().width());
- EXPECT_LT(panel3->GetBounds().width(), panel3->GetRestoredBounds().width());
- EXPECT_LT(panel4->GetBounds().width(), panel4->GetRestoredBounds().width());
- EXPECT_LT(panel5->GetBounds().width(), panel5->GetRestoredBounds().width());
- EXPECT_LT(panel6->GetBounds().width(), panel6->GetRestoredBounds().width());
-
- // Activate a different panel.
- panel2->Activate();
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel2, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // The active panel should be at full width.
- EXPECT_EQ(panel2->GetBounds().width(), panel2->GetRestoredBounds().width());
-
- // The rest of them should be at reduced width.
- EXPECT_LT(panel1->GetBounds().width(), panel1->GetRestoredBounds().width());
- EXPECT_LT(panel3->GetBounds().width(), panel3->GetRestoredBounds().width());
- EXPECT_LT(panel4->GetBounds().width(), panel4->GetRestoredBounds().width());
- EXPECT_LT(panel5->GetBounds().width(), panel5->GetRestoredBounds().width());
- EXPECT_LT(panel6->GetBounds().width(), panel6->GetRestoredBounds().width());
- EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width());
-
- panel_manager->CloseAll();
-}
-
-IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, SqueezeAndThenSomeMore) {
- PanelManager* panel_manager = PanelManager::GetInstance();
-
- // Create enough docked panels to get into squeezing.
- Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100));
- Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100));
- Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100));
- Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100));
- Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100));
- Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100));
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel6, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // Record current widths of some panels.
- int panel_1_width_less_squeezed = panel1->GetBounds().width();
- int panel_2_width_less_squeezed = panel2->GetBounds().width();
- int panel_3_width_less_squeezed = panel3->GetBounds().width();
- int panel_4_width_less_squeezed = panel4->GetBounds().width();
- int panel_5_width_less_squeezed = panel5->GetBounds().width();
-
- // These widths should be reduced.
- EXPECT_LT(panel_1_width_less_squeezed, panel1->GetRestoredBounds().width());
- EXPECT_LT(panel_2_width_less_squeezed, panel2->GetRestoredBounds().width());
- EXPECT_LT(panel_3_width_less_squeezed, panel3->GetRestoredBounds().width());
- EXPECT_LT(panel_4_width_less_squeezed, panel4->GetRestoredBounds().width());
- EXPECT_LT(panel_5_width_less_squeezed, panel5->GetRestoredBounds().width());
-
- Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100));
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel7, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // The active panel should be at full width.
- EXPECT_EQ(panel7->GetBounds().width(), panel7->GetRestoredBounds().width());
-
- // The panels should shrink in width.
- EXPECT_LT(panel1->GetBounds().width(), panel_1_width_less_squeezed);
- EXPECT_LT(panel2->GetBounds().width(), panel_2_width_less_squeezed);
- EXPECT_LT(panel3->GetBounds().width(), panel_3_width_less_squeezed);
- EXPECT_LT(panel4->GetBounds().width(), panel_4_width_less_squeezed);
- EXPECT_LT(panel5->GetBounds().width(), panel_5_width_less_squeezed);
-
- panel_manager->CloseAll();
-}
-
-// http://crbug.com/133463
-#if defined(OS_LINUX)
-#define MAYBE_MinimizeSqueezedActive DISABLED_MinimizeSqueezedActive
-#else
-#define MAYBE_MinimizeSqueezedActive MinimizeSqueezedActive
-#endif
-
-IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, MAYBE_MinimizeSqueezedActive) {
- PanelManager* panel_manager = PanelManager::GetInstance();
-
- // Create enough docked panels to get into squeezing.
- Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100));
- Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100));
- Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100));
- Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100));
- Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100));
- Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100));
- Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100));
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel7, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // The active panel should be at full width.
- EXPECT_EQ(panel7->GetBounds().width(), panel7->GetRestoredBounds().width());
-
- // The rest of them should be at reduced width.
- EXPECT_LT(panel1->GetBounds().width(), panel1->GetRestoredBounds().width());
- EXPECT_LT(panel2->GetBounds().width(), panel2->GetRestoredBounds().width());
- EXPECT_LT(panel3->GetBounds().width(), panel3->GetRestoredBounds().width());
- EXPECT_LT(panel4->GetBounds().width(), panel4->GetRestoredBounds().width());
- EXPECT_LT(panel5->GetBounds().width(), panel5->GetRestoredBounds().width());
- EXPECT_LT(panel6->GetBounds().width(), panel6->GetRestoredBounds().width());
-
- // Record the width of an inactive panel and minimize it.
- int width_of_panel3_squeezed = panel3->GetBounds().width();
- panel3->Minimize();
-
- // Wait for any possible events.
- MessageLoopForUI::current()->RunAllPending();
-
- // Check that this panel is still at the same width.
- EXPECT_EQ(width_of_panel3_squeezed, panel3->GetBounds().width());
-
- // Minimize the active panel. It should become inactive and shrink in width.
- content::WindowedNotificationObserver signal(
- chrome::NOTIFICATION_PANEL_STRIP_UPDATED,
- content::NotificationService::AllSources());
- panel7->Minimize();
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel7, SHOW_AS_INACTIVE);
-
- // Wait for the scheduled layout to run.
- signal.Wait();
-
- // The minimized panel should now be at reduced width.
- EXPECT_LT(panel7->GetBounds().width(), panel7->GetRestoredBounds().width());
-
- panel_manager->CloseAll();
-}
-
-IN_PROC_BROWSER_TEST_F(OldDockedPanelBrowserTest, CloseSqueezedPanels) {
- PanelManager* panel_manager = PanelManager::GetInstance();
-
- // Create enough docked panels to get into squeezing.
- Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 100));
- Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 200, 100));
- Panel* panel3 = CreateDockedPanel("3", gfx::Rect(0, 0, 200, 100));
- Panel* panel4 = CreateDockedPanel("4", gfx::Rect(0, 0, 200, 100));
- Panel* panel5 = CreateDockedPanel("5", gfx::Rect(0, 0, 200, 100));
- Panel* panel6 = CreateDockedPanel("6", gfx::Rect(0, 0, 200, 100));
- Panel* panel7 = CreateDockedPanel("7", gfx::Rect(0, 0, 200, 100));
-
- // Wait for active states to settle.
- WaitForPanelActiveState(panel7, SHOW_AS_ACTIVE);
-
- // Wait for the scheduled layout to run.
- MessageLoopForUI::current()->RunAllPending();
-
- // Record current widths of some panels.
- int panel_1_orig_width = panel1->GetBounds().width();
- int panel_2_orig_width = panel2->GetBounds().width();
- int panel_3_orig_width = panel3->GetBounds().width();
- int panel_4_orig_width = panel4->GetBounds().width();
- int panel_5_orig_width = panel5->GetBounds().width();
- int panel_6_orig_width = panel6->GetBounds().width();
- int panel_7_orig_width = panel7->GetBounds().width();
-
- // The active panel should be at full width.
- EXPECT_EQ(panel_7_orig_width, panel7->GetRestoredBounds().width());
-
- // The rest of them should be at reduced width.
- EXPECT_LT(panel_1_orig_width, panel1->GetRestoredBounds().width());
- EXPECT_LT(panel_2_orig_width, panel2->GetRestoredBounds().width());
- EXPECT_LT(panel_3_orig_width, panel3->GetRestoredBounds().width());
- EXPECT_LT(panel_4_orig_width, panel4->GetRestoredBounds().width());
- EXPECT_LT(panel_5_orig_width, panel5->GetRestoredBounds().width());
- EXPECT_LT(panel_6_orig_width, panel6->GetRestoredBounds().width());
-
- // Close one panel.
- panel2->Close();
-
- // Wait for all processing to finish.
- MessageLoopForUI::current()->RunAllPending();
-
- // The widths of the remaining panels should have increased.
- EXPECT_GT(panel1->GetBounds().width(), panel_1_orig_width);
- EXPECT_GT(panel3->GetBounds().width(), panel_3_orig_width);
- EXPECT_GT(panel4->GetBounds().width(), panel_4_orig_width);
- EXPECT_GT(panel5->GetBounds().width(), panel_5_orig_width);
- EXPECT_GT(panel6->GetBounds().width(), panel_6_orig_width);
-
- // The active panel should have stayed at full width.
- EXPECT_EQ(panel7->GetBounds().width(), panel_7_orig_width);
-
- // Close several panels.
- panel3->Close();
- panel5->Close();
- panel7->Close();
-
- // Wait for all processing to finish.
- MessageLoopForUI::current()->RunAllPending();
-
- // We should not have squeezing any more; all panels should be at full width.
- EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width());
- EXPECT_EQ(panel4->GetBounds().width(), panel4->GetRestoredBounds().width());
- EXPECT_EQ(panel6->GetBounds().width(), panel6->GetRestoredBounds().width());
-
- panel_manager->CloseAll();
-}
« no previous file with comments | « chrome/browser/ui/panels/old_detached_panel_browsertest.cc ('k') | chrome/browser/ui/panels/old_panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698