Chromium Code Reviews| 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 | 827 |
| 828 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) { | 828 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) { |
| 829 TestCreateSettingsMenuForExtension( | 829 TestCreateSettingsMenuForExtension( |
| 830 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, | 830 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, |
| 831 "", ""); | 831 "", ""); |
| 832 TestCreateSettingsMenuForExtension( | 832 TestCreateSettingsMenuForExtension( |
| 833 FILE_PATH_LITERAL("extension2"), Extension::INVALID, | 833 FILE_PATH_LITERAL("extension2"), Extension::INVALID, |
| 834 "http://home", "options.html"); | 834 "http://home", "options.html"); |
| 835 } | 835 } |
| 836 | 836 |
| 837 #if defined(OS_WIN) || defined(OS_MACOSX) | 837 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AutoResize) { |
| 838 #define MAYBE_AutoResize AutoResize | |
| 839 #else | |
| 840 #define MAYBE_AutoResize FLAKY_AutoResize | |
| 841 #endif | |
| 842 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_AutoResize) { | |
| 843 PanelManager::GetInstance()->enable_auto_sizing(true); | 838 PanelManager::GetInstance()->enable_auto_sizing(true); |
| 844 set_testing_work_area(gfx::Rect(0, 0, 1200, 900)); | 839 PanelManager::GetInstance()->SetWorkAreaForTesting( |
|
jennb
2011/12/02 22:57:34
This doesn't change the work area. Just changes a
levin
2011/12/02 23:06:47
I wonder why this method exists. It appears to hav
jennb
2011/12/02 23:23:46
It's used in that test to set the value to 0 so th
| |
| 840 gfx::Rect(0, 0, 1200, 900)); // bigger space is needed by this test | |
| 845 | 841 |
| 846 // Create a test panel with tab contents loaded. | 842 // Create a test panel with tab contents loaded. |
| 847 CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE); | 843 CreatePanelParams params("PanelTest1", gfx::Rect(), SHOW_AS_ACTIVE); |
| 848 GURL url(ui_test_utils::GetTestUrl( | 844 GURL url(ui_test_utils::GetTestUrl( |
| 849 FilePath(kTestDir), | 845 FilePath(kTestDir), |
| 850 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); | 846 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); |
| 851 params.url = url; | 847 params.url = url; |
| 852 Panel* panel = CreatePanelWithParams(params); | 848 Panel* panel = CreatePanelWithParams(params); |
| 853 | 849 |
| 854 // Expand the test page. | 850 // Expand the test page. |
| 855 gfx::Rect initial_bounds = panel->GetBounds(); | 851 gfx::Rect initial_bounds = panel->GetBounds(); |
| 856 ui_test_utils::WindowedNotificationObserver enlarge( | 852 ui_test_utils::WindowedNotificationObserver enlarge( |
| 857 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 853 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 858 content::Source<Panel>(panel)); | 854 content::Source<Panel>(panel)); |
| 859 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( | 855 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 860 panel->browser()->GetSelectedTabContents()->render_view_host(), | 856 panel->browser()->GetSelectedTabContents()->render_view_host(), |
| 861 std::wstring(), | 857 std::wstring(), |
| 862 L"changeSize(10);")); | 858 L"changeSize(50);")); |
| 863 enlarge.Wait(); | 859 enlarge.Wait(); |
| 864 gfx::Rect bounds_on_grow = panel->GetBounds(); | 860 gfx::Rect bounds_on_grow = panel->GetBounds(); |
| 865 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width()); | 861 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width()); |
| 866 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); | 862 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); |
| 867 | 863 |
| 868 // Shrink the test page. | 864 // Shrink the test page. |
| 869 ui_test_utils::WindowedNotificationObserver shrink( | 865 ui_test_utils::WindowedNotificationObserver shrink( |
| 870 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 866 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
| 871 content::Source<Panel>(panel)); | 867 content::Source<Panel>(panel)); |
| 872 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( | 868 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( |
| 873 panel->browser()->GetSelectedTabContents()->render_view_host(), | 869 panel->browser()->GetSelectedTabContents()->render_view_host(), |
| 874 std::wstring(), | 870 std::wstring(), |
| 875 L"changeSize(-5);")); | 871 L"changeSize(-30);")); |
| 876 shrink.Wait(); | 872 shrink.Wait(); |
| 877 gfx::Rect bounds_on_shrink = panel->GetBounds(); | 873 gfx::Rect bounds_on_shrink = panel->GetBounds(); |
| 878 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); | 874 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); |
| 879 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); | 875 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); |
| 880 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); | 876 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); |
| 881 | 877 |
| 882 panel->Close(); | 878 panel->Close(); |
| 883 } | 879 } |
| 884 | 880 |
| 885 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) { | 881 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, AnimateBounds) { |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1938 // position when tall panel brings up its titlebar. | 1934 // position when tall panel brings up its titlebar. |
| 1939 CloseWindowAndWait(panel1->browser()); | 1935 CloseWindowAndWait(panel1->browser()); |
| 1940 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 1936 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
| 1941 GetBalloonBottomPosition(balloon)); | 1937 GetBalloonBottomPosition(balloon)); |
| 1942 | 1938 |
| 1943 // Closing the remaining tall panel should move the notification balloon back | 1939 // Closing the remaining tall panel should move the notification balloon back |
| 1944 // to its original position. | 1940 // to its original position. |
| 1945 CloseWindowAndWait(panel2->browser()); | 1941 CloseWindowAndWait(panel2->browser()); |
| 1946 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 1942 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
| 1947 } | 1943 } |
| OLD | NEW |