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

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: removed IsActive checks from new test Created 8 years, 7 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
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_strip.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
637
638 // Click restore button on a minimized panel. Only that panel will restore.
639 panel2->OnRestoreButtonClicked(panel::NO_MODIFIER);
640 EXPECT_TRUE(panel1->IsMinimized());
641 EXPECT_FALSE(panel2->IsMinimized());
642 EXPECT_TRUE(panel3->IsMinimized());
643
644 // Restore all panels by clicking restore button on a minimized panel.
645 panel3->OnRestoreButtonClicked(panel::APPLY_TO_ALL);
646 EXPECT_FALSE(panel1->IsMinimized());
647 EXPECT_FALSE(panel2->IsMinimized());
648 EXPECT_FALSE(panel3->IsMinimized());
649 }
650
604 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoreAllWithTitlebarClick) { 651 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoreAllWithTitlebarClick) {
605 // We'll simulate mouse movements for test. 652 // We'll simulate mouse movements for test.
606 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); 653 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher();
607 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); 654 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher);
608 655
609 // Test with three panels. 656 // Test with three panels.
610 Panel* panel1 = CreatePanel("PanelTest1"); 657 Panel* panel1 = CreatePanel("PanelTest1");
611 Panel* panel2 = CreatePanel("PanelTest2"); 658 Panel* panel2 = CreatePanel("PanelTest2");
612 Panel* panel3 = CreatePanel("PanelTest3"); 659 Panel* panel3 = CreatePanel("PanelTest3");
613 EXPECT_FALSE(panel1->IsMinimized()); 660 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. 1841 // position when tall panel brings up its titlebar.
1795 CloseWindowAndWait(panel1->browser()); 1842 CloseWindowAndWait(panel1->browser());
1796 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1843 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1797 GetBalloonBottomPosition(balloon)); 1844 GetBalloonBottomPosition(balloon));
1798 1845
1799 // Closing the remaining tall panel should move the notification balloon back 1846 // Closing the remaining tall panel should move the notification balloon back
1800 // to its original position. 1847 // to its original position.
1801 CloseWindowAndWait(panel2->browser()); 1848 CloseWindowAndWait(panel2->browser());
1802 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1849 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1803 } 1850 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698