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

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

Issue 7646003: Support auto-hide taskbar for panels on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
Index: chrome/browser/ui/panels/panel_browser_view_browsertest.cc
===================================================================
--- chrome/browser/ui/panels/panel_browser_view_browsertest.cc (revision 96619)
+++ chrome/browser/ui/panels/panel_browser_view_browsertest.cc (working copy)
@@ -200,7 +200,22 @@
// We put all the testing logic in this class instead of the test so that
// we do not need to declare each new test as a friend of PanelBrowserView
// for the purpose of accessing its private members.
- void TestMinimizeAndRestore() {
+ void TestMinimizeAndRestore(int auto_hide_bottom_bar_height) {
+ PanelManager* panel_manager = PanelManager::GetInstance();
+
+ // Specify the work area for testing purpose.
+ const int kTestWorkAreaWidth = 800;
+ const int kTestWorkAreaHeight = 600;
+ panel_manager->SetWorkArea(
+ gfx::Rect(0, 0, kTestWorkAreaWidth, kTestWorkAreaHeight),
+ auto_hide_bottom_bar_height);
+ panel_manager->should_check_auto_hide_bottom_bar_on_titlebar_change_ =
+ false;
+ int expected_bottom_on_unminimized =
+ kTestWorkAreaHeight - auto_hide_bottom_bar_height;
+ int expected_bottom_on_minimized = kTestWorkAreaHeight;
+
+ // Create and test one panel first.
PanelBrowserView* browser_view1 = CreatePanelBrowserView("PanelTest1",
SHOW_AS_ACTIVE);
Panel* panel1 = browser_view1->panel_.get();
@@ -216,6 +231,7 @@
EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
EXPECT_LT(panel1->GetBounds().height(), titlebar_height);
EXPECT_GT(panel1->GetBounds().height(), 0);
+ EXPECT_EQ(expected_bottom_on_minimized, panel1->GetBounds().bottom());
EXPECT_TRUE(IsMouseWatcherStarted());
EXPECT_FALSE(panel1->IsActive());
WaitTillBoundsAnimationFinished(browser_view1);
@@ -228,6 +244,7 @@
panel1->SetExpansionState(Panel::TITLE_ONLY);
EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
EXPECT_EQ(titlebar_height, panel1->GetBounds().height());
+ EXPECT_EQ(expected_bottom_on_unminimized, panel1->GetBounds().bottom());
WaitTillBoundsAnimationFinished(browser_view1);
EXPECT_TRUE(frame_view1->close_button_->IsVisible());
EXPECT_TRUE(frame_view1->title_icon_->IsVisible());
@@ -236,6 +253,7 @@
panel1->SetExpansionState(Panel::EXPANDED);
EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state());
EXPECT_EQ(initial_height, panel1->GetBounds().height());
+ EXPECT_EQ(expected_bottom_on_unminimized, panel1->GetBounds().bottom());
WaitTillBoundsAnimationFinished(browser_view1);
EXPECT_TRUE(frame_view1->close_button_->IsVisible());
EXPECT_TRUE(frame_view1->title_icon_->IsVisible());
@@ -244,11 +262,13 @@
panel1->SetExpansionState(Panel::TITLE_ONLY);
EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
EXPECT_EQ(titlebar_height, panel1->GetBounds().height());
+ EXPECT_EQ(expected_bottom_on_unminimized, panel1->GetBounds().bottom());
panel1->SetExpansionState(Panel::MINIMIZED);
EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
EXPECT_LT(panel1->GetBounds().height(), titlebar_height);
EXPECT_GT(panel1->GetBounds().height(), 0);
+ EXPECT_EQ(expected_bottom_on_minimized, panel1->GetBounds().bottom());
// Create 2 more panels for more testing.
PanelBrowserView* browser_view2 = CreatePanelBrowserView("PanelTest2",
@@ -264,14 +284,12 @@
panel3->SetExpansionState(Panel::MINIMIZED);
EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
- PanelManager* panel_manager = PanelManager::GetInstance();
-
- panel_manager->BringUpOrDownTitleBarForAllMinimizedPanels(true);
+ panel_manager->BringUpTitleBar();
EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
EXPECT_EQ(Panel::TITLE_ONLY, panel3->expansion_state());
- panel_manager->BringUpOrDownTitleBarForAllMinimizedPanels(false);
+ panel_manager->BringDownTitleBar();
EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
@@ -342,8 +360,7 @@
panel->GetBounds().x(), panel->GetBounds().y()));
// Test that we cannot bring down the panel that is drawing the attention.
- PanelManager::GetInstance()->BringUpOrDownTitleBarForAllMinimizedPanels(
- false);
+ PanelManager::GetInstance()->BringDownTitleBar();
EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state());
// Test that the attention is cleared.
@@ -487,10 +504,18 @@
"http://home", "options.html");
}
-IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, MinimizeAndRestore) {
- TestMinimizeAndRestore();
+IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest,
+ MinimizeAndRestoreOnNormalTaskBar) {
+ // Test that the taskbar is always visible.
+ TestMinimizeAndRestore(0);
Dmitry Titov 2011/08/17 22:56:38 It's incorrect to call a helper function and then
jianli 2011/08/22 20:44:42 The helper function does not use ASSERT_* so it is
}
+IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest,
+ MinimizeAndRestoreOnAutoHideTaskBar) {
+ // Test that the taskbar is in auto-hide mode.
+ TestMinimizeAndRestore(40);
+}
+
IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DrawAttention) {
TestDrawAttention();
}

Powered by Google App Engine
This is Rietveld 408576698