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/base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/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 // Refactor has only been done for Win and Mac panels so far. | 14 // Refactor has only been done for Win and Mac panels so far. |
16 #if defined(OS_WIN) || defined(OS_MACOSX) | 15 #if defined(OS_WIN) || defined(OS_MACOSX) |
17 | 16 |
18 class PanelDragBrowserTest : public BasePanelBrowserTest { | 17 class PanelDragBrowserTest : public BasePanelBrowserTest { |
19 public: | 18 public: |
20 PanelDragBrowserTest() : BasePanelBrowserTest() { | 19 PanelDragBrowserTest() : BasePanelBrowserTest() { |
21 } | 20 } |
22 | 21 |
23 virtual ~PanelDragBrowserTest() { | 22 virtual ~PanelDragBrowserTest() { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 398 |
400 panel3_testing->CancelDragTitlebar(); | 399 panel3_testing->CancelDragTitlebar(); |
401 EXPECT_EQ(position2, panel1->GetBounds().origin()); | 400 EXPECT_EQ(position2, panel1->GetBounds().origin()); |
402 EXPECT_EQ(position3, panel2->GetBounds().origin()); | 401 EXPECT_EQ(position3, panel2->GetBounds().origin()); |
403 EXPECT_EQ(position1, panel3->GetBounds().origin()); | 402 EXPECT_EQ(position1, panel3->GetBounds().origin()); |
404 | 403 |
405 PanelManager::GetInstance()->CloseAll(); | 404 PanelManager::GetInstance()->CloseAll(); |
406 } | 405 } |
407 | 406 |
408 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragMinimizedPanel) { | 407 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragMinimizedPanel) { |
409 // We'll simulate mouse movements for test. | |
410 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | |
411 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); | |
412 | |
413 Panel* panel = CreatePanel("panel1"); | 408 Panel* panel = CreatePanel("panel1"); |
414 scoped_ptr<NativePanelTesting> panel_testing( | 409 scoped_ptr<NativePanelTesting> panel_testing( |
415 CreateNativePanelTesting(panel)); | 410 CreateNativePanelTesting(panel)); |
416 | 411 |
417 panel->Minimize(); | 412 panel->Minimize(); |
418 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 413 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
419 | 414 |
420 // Hover over minimized panel to bring up titlebar. | 415 // Hover over minimized panel to bring up titlebar. |
421 gfx::Point hover_point(panel->GetBounds().origin()); | 416 gfx::Point hover_point(panel->GetBounds().origin()); |
422 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); | 417 MoveMouseAndWaitForExpansionStateChange(panel, hover_point); |
(...skipping 19 matching lines...) Expand all Loading... |
442 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); | 437 EXPECT_EQ(Panel::TITLE_ONLY, panel->expansion_state()); |
443 | 438 |
444 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); | 439 MoveMouseAndWaitForExpansionStateChange(panel, mouse_location); |
445 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 440 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
446 | 441 |
447 panel->Close(); | 442 panel->Close(); |
448 } | 443 } |
449 | 444 |
450 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, | 445 IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, |
451 DragMinimizedPanelWhileDrawingAttention) { | 446 DragMinimizedPanelWhileDrawingAttention) { |
452 // We'll simulate mouse movements for test. | |
453 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | |
454 PanelManager::GetInstance()->SetMouseWatcherForTesting(mouse_watcher); | |
455 | |
456 Panel* panel = CreatePanel("panel1"); | 447 Panel* panel = CreatePanel("panel1"); |
457 scoped_ptr<NativePanelTesting> panel_testing( | 448 scoped_ptr<NativePanelTesting> panel_testing( |
458 CreateNativePanelTesting(panel)); | 449 CreateNativePanelTesting(panel)); |
459 CreatePanel("panel2"); | 450 CreatePanel("panel2"); |
460 | 451 |
461 panel->Minimize(); | 452 panel->Minimize(); |
462 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); | 453 EXPECT_EQ(Panel::MINIMIZED, panel->expansion_state()); |
463 | 454 |
464 panel->FlashFrame(true); | 455 panel->FlashFrame(true); |
465 EXPECT_TRUE(panel->IsDrawingAttention()); | 456 EXPECT_TRUE(panel->IsDrawingAttention()); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 // constraint. | 1330 // constraint. |
1340 drag_to_location = gfx::Point(280, 150); | 1331 drag_to_location = gfx::Point(280, 150); |
1341 DragPanelToMouseLocation(panel, drag_to_location); | 1332 DragPanelToMouseLocation(panel, drag_to_location); |
1342 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); | 1333 EXPECT_EQ(PanelStrip::DETACHED, panel->panel_strip()->type()); |
1343 EXPECT_EQ(drag_to_location, panel->GetBounds().origin()); | 1334 EXPECT_EQ(drag_to_location, panel->GetBounds().origin()); |
1344 | 1335 |
1345 panel_manager->CloseAll(); | 1336 panel_manager->CloseAll(); |
1346 } | 1337 } |
1347 | 1338 |
1348 #endif // OS_WIN || OS_MACOSX | 1339 #endif // OS_WIN || OS_MACOSX |
OLD | NEW |