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

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

Issue 9403035: Refactor intra-strip panel drags by introducing PanelDragController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback 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 041021d8c373cfec33f884bf1e97865da5f9d2a3..aa96c01dbbbc2cc624ff582f902dc765ec178c3b 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -770,7 +770,8 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DragThreePanels) {
IN_PROC_BROWSER_TEST_F(PanelBrowserTest, NotDraggable) {
Panel* panel = CreatePanel("panel");
- panel->set_draggable(false);
+ // This is used to simulate making a docked panel not draggable.
+ panel->set_has_temporary_layout(true);
Panel* panel2 = CreatePanel("panel2");
scoped_ptr<NativePanelTesting> panel_testing(
@@ -783,10 +784,33 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, NotDraggable) {
panel_testing->FinishDragTitlebar();
EXPECT_EQ(bounds.x(), panel->GetBounds().x());
+ // Reset the simulation hack so that the panel can be closed correctly.
+ panel->set_has_temporary_layout(false);
panel->Close();
panel2->Close();
}
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CloseDraggingPanel) {
+ PanelManager* panel_manager = PanelManager::GetInstance();
+
+ // Create one panel.
+ Panel* panel = CreatePanel("panel");
+
+ // Start dragging the panel.
+ scoped_ptr<NativePanelTesting> panel_testing(
+ NativePanelTesting::Create(panel->native_panel()));
+ panel_testing->PressLeftMouseButtonTitlebar(panel->GetBounds().origin());
+ panel_testing->DragTitlebar(-51, 102);
+
+ // Closing the panel while drag in progress will keep the panel intact.
+ 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.
+ EXPECT_EQ(1, panel_manager->num_panels());
+
+ // It should be closed right after the drag ends.
+ panel_testing->FinishDragTitlebar();
+ EXPECT_EQ(0, panel_manager->num_panels());
+}
+
IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateSettingsMenu) {
TestCreateSettingsMenuForExtension(
FILE_PATH_LITERAL("extension1"), Extension::EXTERNAL_POLICY_DOWNLOAD,

Powered by Google App Engine
This is Rietveld 408576698