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

Unified 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: Ensure that the latest version is uploaded. Created 8 years, 10 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_browsertest.cc
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index ada5e7e70c025cc2af57ead6f6e3e8a13d9d20a9..bab05fe6654dc2142c3ee2bc843a4821fc2c9b3a 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -800,10 +800,11 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) {
}
// Flaky: http://crbug.com/105445
-IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_AutoResize) {
- PanelManager::GetInstance()->enable_auto_sizing(true);
- PanelManager::GetInstance()->SetWorkAreaForTesting(
- gfx::Rect(0, 0, 1200, 900)); // bigger space is needed by this test
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) {
jennb 2012/02/29 19:46:00 Remember to leave this DISABLED before commit as i
levin 2012/02/29 23:48:28 Done. Thanks!
+ PanelManager* panel_manager = PanelManager::GetInstance();
+ panel_manager->enable_auto_sizing(true);
+ // Bigger space is needed by this test.
+ panel_manager->SetWorkAreaForTesting(gfx::Rect(0, 0, 1200, 900));
// Create a test panel with tab contents loaded.
CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE);
@@ -841,6 +842,27 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_AutoResize) {
EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width());
EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height());
+ // Verify resizing turns off auto-resizing and that it works.
+ gfx::Rect previous_bounds = panel->GetBounds();
+ // These should be identical because the panel is expanded.
+ EXPECT_EQ(previous_bounds.size(), panel->GetRestoredBounds().size());
+ gfx::Size new_size(previous_bounds.size());
+ new_size.Enlarge(5, 5);
+ panel_manager->ResizePanel(panel, new_size);
+ EXPECT_FALSE(panel->auto_resizable());
+ EXPECT_EQ(new_size, panel->GetBounds().size());
+ EXPECT_EQ(new_size, panel->GetRestoredBounds().size());
+
+ // Turn back on auto-resize and verify that it works.
+ ui_test_utils::WindowedNotificationObserver auto_resize_enabled(
+ chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
+ content::Source<Panel>(panel));
+ panel->SetAutoResizable(true);
+ auto_resize_enabled.Wait();
+ gfx::Rect bounds_auto_resize_enabled = panel->GetBounds();
+ EXPECT_EQ(bounds_on_shrink.width(), bounds_auto_resize_enabled.width());
+ EXPECT_EQ(bounds_on_shrink.height(), bounds_auto_resize_enabled.height());
+
panel->Close();
}
@@ -852,17 +874,12 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, ResizePanel) {
EXPECT_TRUE(panel->auto_resizable());
EXPECT_EQ(Panel::EXPANDED, panel->expansion_state());
- // Verify resizing an auto-resizable panel is a no-op for now.
- // http://crbug.com/109343
+ // Verify resizing turns off auto-resizing and that it works.
gfx::Rect original_bounds = panel->GetBounds();
- gfx::Rect original_restored_bounds = panel->GetRestoredBounds();
- gfx::Size new_size(150, 200);
- panel_manager->ResizePanel(panel, new_size);
- EXPECT_EQ(original_bounds, panel->GetBounds());
- EXPECT_EQ(original_restored_bounds, panel->GetRestoredBounds());
-
- // Verify resizing adjusts bounds correctly when not auto-resizable.
- panel->SetAutoResizable(false);
+ // These should be identical because the panel is expanded.
+ EXPECT_EQ(original_bounds.size(), panel->GetRestoredBounds().size());
+ gfx::Size new_size(original_bounds.size());
+ new_size.Enlarge(5, 5);
panel_manager->ResizePanel(panel, new_size);
EXPECT_FALSE(panel->auto_resizable());
EXPECT_EQ(new_size, panel->GetBounds().size());

Powered by Google App Engine
This is Rietveld 408576698