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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" |
7 #include "chrome/browser/ui/panels/detached_panel_strip.h" | 7 #include "chrome/browser/ui/panels/detached_panel_strip.h" |
8 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 8 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
9 #include "chrome/browser/ui/panels/native_panel.h" | 9 #include "chrome/browser/ui/panels/native_panel.h" |
10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
11 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 11 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
12 #include "chrome/browser/ui/panels/panel_manager.h" | 12 #include "chrome/browser/ui/panels/panel_manager.h" |
13 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | |
14 | 13 |
15 class OldPanelDragBrowserTest : public OldBasePanelBrowserTest { | 14 class OldPanelDragBrowserTest : public OldBasePanelBrowserTest { |
16 public: | 15 public: |
17 OldPanelDragBrowserTest() : OldBasePanelBrowserTest() { | 16 OldPanelDragBrowserTest() : OldBasePanelBrowserTest() { |
18 } | 17 } |
19 | 18 |
20 virtual ~OldPanelDragBrowserTest() { | 19 virtual ~OldPanelDragBrowserTest() { |
21 } | 20 } |
22 | 21 |
23 virtual void SetUpOnMainThread() OVERRIDE { | 22 virtual void SetUpOnMainThread() OVERRIDE { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 395 |
397 panel3_testing->CancelDragTitlebar(); | 396 panel3_testing->CancelDragTitlebar(); |
398 EXPECT_EQ(position2, panel1->GetBounds().origin()); | 397 EXPECT_EQ(position2, panel1->GetBounds().origin()); |
399 EXPECT_EQ(position3, panel2->GetBounds().origin()); | 398 EXPECT_EQ(position3, panel2->GetBounds().origin()); |
400 EXPECT_EQ(position1, panel3->GetBounds().origin()); | 399 EXPECT_EQ(position1, panel3->GetBounds().origin()); |
401 | 400 |
402 PanelManager::GetInstance()->CloseAll(); | 401 PanelManager::GetInstance()->CloseAll(); |
403 } | 402 } |
404 | 403 |
405 IN_PROC_BROWSER_TEST_F(OldPanelDragBrowserTest, DragMinimizedPanel) { | 404 IN_PROC_BROWSER_TEST_F(OldPanelDragBrowserTest, DragMinimizedPanel) { |
406 // We'll simulate mouse movements for test. | |
407 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | |
408 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); | |
409 | |
410 Panel* panel = CreatePanel("panel1"); | 405 Panel* panel = CreatePanel("panel1"); |
411 scoped_ptr<NativePanelTesting> panel_testing( | 406 scoped_ptr<NativePanelTesting> panel_testing( |
412 CreateNativePanelTesting(panel)); | 407 CreateNativePanelTesting(panel)); |
413 | 408 |
414 panel->Minimize(); | 409 panel->Minimize(); |
415 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 410 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
416 | 411 |
417 // Hover over minimized panel to bring up titlebar. | 412 // Hover over minimized panel to bring up titlebar. |
418 gfx::Point hover_point(panel->GetBounds().origin()); | 413 gfx::Point hover_point(panel->GetBounds().origin()); |
419 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); | 414 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); |
(...skipping 19 matching lines...) Expand all Loading... |
439 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 434 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
440 | 435 |
441 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); | 436 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); |
442 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 437 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
443 | 438 |
444 panel->Close(); | 439 panel->Close(); |
445 } | 440 } |
446 | 441 |
447 IN_PROC_BROWSER_TEST_F(OldPanelDragBrowserTest, | 442 IN_PROC_BROWSER_TEST_F(OldPanelDragBrowserTest, |
448 DragMinimizedPanelWhileDrawingAttention) { | 443 DragMinimizedPanelWhileDrawingAttention) { |
449 // We'll simulate mouse movements for test. | |
450 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | |
451 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); | |
452 | |
453 Panel* panel = CreatePanel("panel1"); | 444 Panel* panel = CreatePanel("panel1"); |
454 scoped_ptr<NativePanelTesting> panel_testing( | 445 scoped_ptr<NativePanelTesting> panel_testing( |
455 CreateNativePanelTesting(panel)); | 446 CreateNativePanelTesting(panel)); |
456 CreatePanel("panel2"); | 447 CreatePanel("panel2"); |
457 | 448 |
458 panel->Minimize(); | 449 panel->Minimize(); |
459 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 450 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
460 | 451 |
461 panel->FlashFrame(true); | 452 panel->FlashFrame(true); |
462 EXPECT_TRUE(panel->IsDrawingAttention()); | 453 EXPECT_TRUE(panel->IsDrawingAttention()); |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 | 1333 |
1343 // Drag down the panel. Expect that the panel can be dragged without | 1334 // Drag down the panel. Expect that the panel can be dragged without |
1344 // constraint. | 1335 // constraint. |
1345 drag_to_location = gfx::Point(280, 150); | 1336 drag_to_location = gfx::Point(280, 150); |
1346 DragPanelToMouseLocation(panel, drag_to_location); | 1337 DragPanelToMouseLocation(panel, drag_to_location); |
1347 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); | 1338 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); |
1348 EXPECT_EQ(drag_to_location, panel->GetBounds().origin()); | 1339 EXPECT_EQ(drag_to_location, panel->GetBounds().origin()); |
1349 | 1340 |
1350 panel_manager->CloseAll(); | 1341 panel_manager->CloseAll(); |
1351 } | 1342 } |
OLD | NEW |