OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/download/download_service.h" | 9 #include "chrome/browser/download/download_service.h" |
10 #include "chrome/browser/download/download_service_factory.h" | 10 #include "chrome/browser/download/download_service_factory.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 L"changeSize(-30);")); | 875 L"changeSize(-30);")); |
876 shrink.Wait(); | 876 shrink.Wait(); |
877 gfx::Rect bounds_on_shrink = panel->GetBounds(); | 877 gfx::Rect bounds_on_shrink = panel->GetBounds(); |
878 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); | 878 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); |
879 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); | 879 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); |
880 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); | 880 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); |
881 | 881 |
882 panel->Close(); | 882 panel->Close(); |
883 } | 883 } |
884 | 884 |
| 885 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) { |
| 886 Panel* panel = CreatePanelWithBounds("PanelTest", gfx::Rect(0, 0, 100, 100)); |
| 887 scoped_ptr<NativePanelTesting> panel_testing( |
| 888 NativePanelTesting::Create(panel->native_panel())); |
| 889 |
| 890 // Set bounds with animation. |
| 891 gfx::Rect bounds = gfx::Rect(10, 20, 150, 160); |
| 892 panel->SetPanelBounds(bounds); |
| 893 EXPECT_TRUE(panel_testing->IsAnimatingBounds()); |
| 894 WaitForBoundsAnimationFinished(panel); |
| 895 EXPECT_FALSE(panel_testing->IsAnimatingBounds()); |
| 896 EXPECT_EQ(bounds, panel->GetBounds()); |
| 897 |
| 898 // Set bounds without animation. |
| 899 bounds = gfx::Rect(30, 40, 200, 220); |
| 900 panel->SetPanelBoundsInstantly(bounds); |
| 901 EXPECT_FALSE(panel_testing->IsAnimatingBounds()); |
| 902 EXPECT_EQ(bounds, panel->GetBounds()); |
| 903 |
| 904 panel->Close(); |
| 905 } |
| 906 |
885 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoredBounds) { | 907 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, RestoredBounds) { |
886 // Disable mouse watcher. We don't care about mouse movements in this test. | 908 // Disable mouse watcher. We don't care about mouse movements in this test. |
887 PanelManager* panel_manager = PanelManager::GetInstance(); | 909 PanelManager* panel_manager = PanelManager::GetInstance(); |
888 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | 910 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); |
889 panel_manager->set_mouse_watcher(mouse_watcher); | 911 panel_manager->set_mouse_watcher(mouse_watcher); |
890 Panel* panel = CreatePanelWithBounds("PanelTest", gfx::Rect(0, 0, 100, 100)); | 912 Panel* panel = CreatePanelWithBounds("PanelTest", gfx::Rect(0, 0, 100, 100)); |
891 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); | 913 EXPECT_EQ(Panel::EXPANDED, panel->expansion_state()); |
892 EXPECT_EQ(panel->GetBounds(), panel->GetRestoredBounds()); | 914 EXPECT_EQ(panel->GetBounds(), panel->GetRestoredBounds()); |
893 EXPECT_EQ(0, panel_manager->minimized_panel_count()); | 915 EXPECT_EQ(0, panel_manager->minimized_panel_count()); |
894 | 916 |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 // position when tall panel brings up its titlebar. | 1938 // position when tall panel brings up its titlebar. |
1917 CloseWindowAndWait(panel1->browser()); | 1939 CloseWindowAndWait(panel1->browser()); |
1918 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 1940 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
1919 GetBalloonBottomPosition(balloon)); | 1941 GetBalloonBottomPosition(balloon)); |
1920 | 1942 |
1921 // Closing the remaining tall panel should move the notification balloon back | 1943 // Closing the remaining tall panel should move the notification balloon back |
1922 // to its original position. | 1944 // to its original position. |
1923 CloseWindowAndWait(panel2->browser()); | 1945 CloseWindowAndWait(panel2->browser()); |
1924 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 1946 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
1925 } | 1947 } |
OLD | NEW |