OLD | NEW |
---|---|
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL); | 763 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL); |
764 } | 764 } |
765 | 765 |
766 panel1->Close(); | 766 panel1->Close(); |
767 panel2->Close(); | 767 panel2->Close(); |
768 panel3->Close(); | 768 panel3->Close(); |
769 } | 769 } |
770 | 770 |
771 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, NotDraggable) { | 771 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, NotDraggable) { |
772 Panel* panel = CreatePanel("panel"); | 772 Panel* panel = CreatePanel("panel"); |
773 panel->set_draggable(false); | 773 // This is used to simulate making a docked panel not draggable. |
774 panel->set_has_temporary_layout(true); | |
774 Panel* panel2 = CreatePanel("panel2"); | 775 Panel* panel2 = CreatePanel("panel2"); |
775 | 776 |
776 scoped_ptr<NativePanelTesting> panel_testing( | 777 scoped_ptr<NativePanelTesting> panel_testing( |
777 NativePanelTesting::Create(panel->native_panel())); | 778 NativePanelTesting::Create(panel->native_panel())); |
778 gfx::Rect bounds = panel->GetBounds(); | 779 gfx::Rect bounds = panel->GetBounds(); |
779 panel_testing->PressLeftMouseButtonTitlebar(bounds.origin()); | 780 panel_testing->PressLeftMouseButtonTitlebar(bounds.origin()); |
780 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); | 781 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); |
781 panel_testing->DragTitlebar(-50, 10); | 782 panel_testing->DragTitlebar(-50, 10); |
782 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); | 783 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); |
783 panel_testing->FinishDragTitlebar(); | 784 panel_testing->FinishDragTitlebar(); |
784 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); | 785 EXPECT_EQ(bounds.x(), panel->GetBounds().x()); |
785 | 786 |
787 // Reset the simulation hack so that the panel can be closed correctly. | |
788 panel->set_has_temporary_layout(false); | |
786 panel->Close(); | 789 panel->Close(); |
787 panel2->Close(); | 790 panel2->Close(); |
788 } | 791 } |
789 | 792 |
793 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CloseDraggingPanel) { | |
794 PanelManager* panel_manager = PanelManager::GetInstance(); | |
795 | |
796 // Create one panel. | |
797 Panel* panel = CreatePanel("panel"); | |
798 | |
799 // Start dragging the panel. | |
800 scoped_ptr<NativePanelTesting> panel_testing( | |
801 NativePanelTesting::Create(panel->native_panel())); | |
802 panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); | |
803 panel_testing->DragTitlebar(-51, 102); | |
804 | |
805 // Closing the panel while drag in progress will keep the panel intact. | |
806 panel->Close(); | |
jennb
2012/02/17 21:28:45
Close is async so this will always continue with n
jianli
2012/02/17 23:52:56
ditto.
| |
807 EXPECT_EQ(1, panel_manager->num_panels()); | |
808 | |
809 // It should be closed right after the drag ends. | |
810 panel_testing->FinishDragTitlebar(); | |
811 EXPECT_EQ(0, panel_manager->num_panels()); | |
812 } | |
813 | |
790 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) { | 814 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) { |
791 TestCreateSettingsMenuForExtension( | 815 TestCreateSettingsMenuForExtension( |
792 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, | 816 FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD, |
793 "", ""); | 817 "", ""); |
794 TestCreateSettingsMenuForExtension( | 818 TestCreateSettingsMenuForExtension( |
795 FILE_PATH_LITERAL("extension2"), Extension::INVALID, | 819 FILE_PATH_LITERAL("extension2"), Extension::INVALID, |
796 "http://home", "options.html"); | 820 "http://home", "options.html"); |
797 } | 821 } |
798 | 822 |
799 // Flaky: http://crbug.com/105445 | 823 // Flaky: http://crbug.com/105445 |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1999 // position when tall panel brings up its titlebar. | 2023 // position when tall panel brings up its titlebar. |
2000 CloseWindowAndWait(panel1->browser()); | 2024 CloseWindowAndWait(panel1->browser()); |
2001 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 2025 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
2002 GetBalloonBottomPosition(balloon)); | 2026 GetBalloonBottomPosition(balloon)); |
2003 | 2027 |
2004 // Closing the remaining tall panel should move the notification balloon back | 2028 // Closing the remaining tall panel should move the notification balloon back |
2005 // to its original position. | 2029 // to its original position. |
2006 CloseWindowAndWait(panel2->browser()); | 2030 CloseWindowAndWait(panel2->browser()); |
2007 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 2031 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
2008 } | 2032 } |
OLD | NEW |