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

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 10173035: Add key modifier on minimize/restore button click to minimize/restore all Panels for Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/download/download_service.h" 8 #include "chrome/browser/download/download_service.h"
9 #include "chrome/browser/download/download_service_factory.h" 9 #include "chrome/browser/download/download_service_factory.h"
10 #include "chrome/browser/net/url_request_mock_util.h" 10 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 // Test with three panels. 595 // Test with three panels.
596 CreatePanelWithBounds("PanelTest1", gfx::Rect(0, 0, 100, 100)); 596 CreatePanelWithBounds("PanelTest1", gfx::Rect(0, 0, 100, 100));
597 CreatePanelWithBounds("PanelTest2", gfx::Rect(0, 0, 110, 110)); 597 CreatePanelWithBounds("PanelTest2", gfx::Rect(0, 0, 110, 110));
598 CreatePanelWithBounds("PanelTest3", gfx::Rect(0, 0, 120, 120)); 598 CreatePanelWithBounds("PanelTest3", gfx::Rect(0, 0, 120, 120));
599 TestMinimizeRestore(); 599 TestMinimizeRestore();
600 600
601 PanelManager::GetInstance()->CloseAll(); 601 PanelManager::GetInstance()->CloseAll();
602 } 602 }
603 603
604 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MinimizeRestoreButtonClick) {
605 // Test with three panels.
606 Panel* panel1 = CreatePanel("PanelTest1");
607 Panel* panel2 = CreatePanel("PanelTest2");
608 Panel* panel3 = CreatePanel("PanelTest3");
609 EXPECT_FALSE(panel1->IsMinimized());
610 EXPECT_FALSE(panel2->IsMinimized());
611 EXPECT_FALSE(panel3->IsMinimized());
612
613 // Click restore button on an expanded panel. Expect no change.
614 panel1->OnRestoreButtonClicked(panel::NO_MODIFIER);
615 EXPECT_FALSE(panel1->IsMinimized());
616 EXPECT_FALSE(panel2->IsMinimized());
617 EXPECT_FALSE(panel3->IsMinimized());
618
619 // Click minimize button on an expanded panel. Only that panel will minimize.
620 panel1->OnMinimizeButtonClicked(panel::NO_MODIFIER);
621 EXPECT_TRUE(panel1->IsMinimized());
622 EXPECT_FALSE(panel2->IsMinimized());
623 EXPECT_FALSE(panel3->IsMinimized());
624
625 // Click minimize button on a minimized panel. Expect no change.
626 panel1->OnMinimizeButtonClicked(panel::NO_MODIFIER);
627 EXPECT_TRUE(panel1->IsMinimized());
628 EXPECT_FALSE(panel2->IsMinimized());
629 EXPECT_FALSE(panel3->IsMinimized());
630
631 // Minimize all panels by clicking minimize button on an expanded panel
632 // with the apply-all modifier.
633 panel2->OnMinimizeButtonClicked(panel::APPLY_TO_ALL);
634 EXPECT_TRUE(panel1->IsMinimized());
635 EXPECT_TRUE(panel2->IsMinimized());
636 EXPECT_TRUE(panel3->IsMinimized());
jianli 2012/04/26 18:06:57 It would be better to insert one more test case he
jennb 2012/04/27 00:30:11 Added.
637
638 // Restore all panels by clicking restore button on a minimized panel.
639 panel3->OnRestoreButtonClicked(panel::APPLY_TO_ALL);
640 EXPECT_FALSE(panel1->IsMinimized());
641 EXPECT_FALSE(panel2->IsMinimized());
642 EXPECT_FALSE(panel3->IsMinimized());
643 }
644
604 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoreAllWithTitlebarClick) { 645 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoreAllWithTitlebarClick) {
605 // We'll simulate mouse movements for test. 646 // We'll simulate mouse movements for test.
606 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); 647 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher();
607 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); 648 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher);
608 649
609 // Test with three panels. 650 // Test with three panels.
610 Panel* panel1 = CreatePanel("PanelTest1"); 651 Panel* panel1 = CreatePanel("PanelTest1");
611 Panel* panel2 = CreatePanel("PanelTest2"); 652 Panel* panel2 = CreatePanel("PanelTest2");
612 Panel* panel3 = CreatePanel("PanelTest3"); 653 Panel* panel3 = CreatePanel("PanelTest3");
613 EXPECT_FALSE(panel1->IsMinimized()); 654 EXPECT_FALSE(panel1->IsMinimized());
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 // position when tall panel brings up its titlebar. 1835 // position when tall panel brings up its titlebar.
1795 CloseWindowAndWait(panel1->browser()); 1836 CloseWindowAndWait(panel1->browser());
1796 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1837 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1797 GetBalloonBottomPosition(balloon)); 1838 GetBalloonBottomPosition(balloon));
1798 1839
1799 // Closing the remaining tall panel should move the notification balloon back 1840 // Closing the remaining tall panel should move the notification balloon back
1800 // to its original position. 1841 // to its original position.
1801 CloseWindowAndWait(panel2->browser()); 1842 CloseWindowAndWait(panel2->browser());
1802 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1843 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1803 } 1844 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698