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

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

Issue 9517010: Change panels to be able to turn off autoresize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 } 845 }
846 846
847 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, ResizePanel) { 847 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, ResizePanel) {
848 PanelManager* panel_manager = PanelManager::GetInstance(); 848 PanelManager* panel_manager = PanelManager::GetInstance();
849 panel_manager->enable_auto_sizing(true); 849 panel_manager->enable_auto_sizing(true);
850 850
851 Panel* panel = CreatePanel("TestPanel"); 851 Panel* panel = CreatePanel("TestPanel");
852 EXPECT_TRUE(panel->auto_resizable()); 852 EXPECT_TRUE(panel->auto_resizable());
853 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); 853 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
854 854
855 // Verify resizing an auto-resizable panel is a no-op for now. 855 // Verify resizing an auto-resizable panel is a no-op for now.
jennb 2012/02/28 23:45:15 update comment to say it also turns off auto-resiz
levin 2012/02/29 00:04:43 Done.
856 // http://crbug.com/109343
857 gfx::Rect original_bounds = panel->GetBounds(); 856 gfx::Rect original_bounds = panel->GetBounds();
858 gfx::Rect original_restored_bounds = panel->GetRestoredBounds(); 857 gfx::Rect original_restored_bounds = panel->GetRestoredBounds();
859 gfx::Size new_size(150, 200); 858 gfx::Size new_size(150, 200);
jennb 2012/02/28 23:45:15 Could do: gfx::Size new_size original_bounds.siz
levin 2012/02/29 00:04:43 Done.
860 panel_manager->ResizePanel(panel, new_size); 859 EXPECT_NE(new_size, original_bounds.size());
861 EXPECT_EQ(original_bounds, panel->GetBounds()); 860 EXPECT_NE(new_size, original_restored_bounds.size());
862 EXPECT_EQ(original_restored_bounds, panel->GetRestoredBounds());
863
864 // Verify resizing adjusts bounds correctly when not auto-resizable.
865 panel->SetAutoResizable(false);
866 panel_manager->ResizePanel(panel, new_size); 861 panel_manager->ResizePanel(panel, new_size);
867 EXPECT_FALSE(panel->auto_resizable()); 862 EXPECT_FALSE(panel->auto_resizable());
868 EXPECT_EQ(new_size, panel->GetBounds().size()); 863 EXPECT_EQ(new_size, panel->GetBounds().size());
869 EXPECT_EQ(new_size, panel->GetRestoredBounds().size()); 864 EXPECT_EQ(new_size, panel->GetRestoredBounds().size());
870 865
866
jennb 2012/02/28 23:45:15 extra blank line?
levin 2012/02/29 00:04:43 Done.
871 // Verify current height unaffected when panel is not expanded. 867 // Verify current height unaffected when panel is not expanded.
872 panel->SetExpansionState(Panel::MINIMIZED); 868 panel->SetExpansionState(Panel::MINIMIZED);
873 int original_height = panel->GetBounds().height(); 869 int original_height = panel->GetBounds().height();
874 new_size.Enlarge(5, 5); 870 new_size.Enlarge(5, 5);
875 panel_manager->ResizePanel(panel, new_size); 871 panel_manager->ResizePanel(panel, new_size);
876 EXPECT_EQ(new_size.width(), panel->GetBounds().width()); 872 EXPECT_EQ(new_size.width(), panel->GetBounds().width());
877 EXPECT_EQ(original_height, panel->GetBounds().height()); 873 EXPECT_EQ(original_height, panel->GetBounds().height());
878 EXPECT_EQ(new_size, panel->GetRestoredBounds().size()); 874 EXPECT_EQ(new_size, panel->GetRestoredBounds().size());
879 875
880 panel->Close(); 876 panel->Close();
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 // position when tall panel brings up its titlebar. 1993 // position when tall panel brings up its titlebar.
1998 CloseWindowAndWait(panel1->browser()); 1994 CloseWindowAndWait(panel1->browser());
1999 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1995 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
2000 GetBalloonBottomPosition(balloon)); 1996 GetBalloonBottomPosition(balloon));
2001 1997
2002 // Closing the remaining tall panel should move the notification balloon back 1998 // Closing the remaining tall panel should move the notification balloon back
2003 // to its original position. 1999 // to its original position.
2004 CloseWindowAndWait(panel2->browser()); 2000 CloseWindowAndWait(panel2->browser());
2005 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 2001 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
2006 } 2002 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698