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

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

Issue 8775022: Add Panel::SetPanelBoundsInstantly for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 b4292ac8b39ef126cda22f2dab1c082dc1dc1380..41e0d88a38f49a4b28cd6b1a7e0fec6d971a3ab3 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -882,6 +882,28 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_AutoResize) {
panel->Close();
}
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) {
+ Panel* panel = CreatePanelWithBounds("PanelTest", gfx::Rect(0, 0, 100, 100));
+ scoped_ptr<NativePanelTesting> panel_testing(
+ NativePanelTesting::Create(panel->native_panel()));
+
+ // Set bounds with animation.
+ gfx::Rect bounds = gfx::Rect(10, 20, 150, 160);
+ panel->SetPanelBounds(bounds, true); // use animation.
+ EXPECT_TRUE(panel_testing->IsAnimatingBounds());
+ WaitForBoundsAnimationFinished(panel);
+ EXPECT_FALSE(panel_testing->IsAnimatingBounds());
+ EXPECT_EQ(bounds, panel->GetBounds());
+
+ // Set bounds without animation.
+ bounds = gfx::Rect(30, 40, 200, 220);
+ panel->SetPanelBounds(bounds, false); // no animation.
+ EXPECT_FALSE(panel_testing->IsAnimatingBounds());
+ EXPECT_EQ(bounds, panel->GetBounds());
+
+ panel->Close();
+}
+
IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoredBounds) {
// Disable mouse watcher. We don't care about mouse movements in this test.
PanelManager* panel_manager = PanelManager::GetInstance();
@@ -931,19 +953,19 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoredBounds) {
int saved_restored_height = restored.height();
panel->SetExpansionState(Panel::MINIMIZED);
bounds = gfx::Rect(10, 20, 300, 400);
- panel->SetPanelBounds(bounds);
+ panel->SetPanelBounds(bounds, true); // use animation.
EXPECT_EQ(saved_restored_height, panel->GetRestoredBounds().height());
EXPECT_EQ(1, panel_manager->minimized_panel_count());
panel->SetExpansionState(Panel::TITLE_ONLY);
bounds = gfx::Rect(20, 30, 100, 200);
- panel->SetPanelBounds(bounds);
+ panel->SetPanelBounds(bounds, true); // use animation.
EXPECT_EQ(saved_restored_height, panel->GetRestoredBounds().height());
EXPECT_EQ(1, panel_manager->minimized_panel_count());
panel->SetExpansionState(Panel::EXPANDED);
bounds = gfx::Rect(40, 60, 300, 400);
- panel->SetPanelBounds(bounds);
+ panel->SetPanelBounds(bounds, true); // use animation.
EXPECT_NE(saved_restored_height, panel->GetRestoredBounds().height());
EXPECT_EQ(0, panel_manager->minimized_panel_count());

Powered by Google App Engine
This is Rietveld 408576698