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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // FindBar needs tab contents. | 452 // FindBar needs tab contents. |
453 CreateTestTabContents(browser); | 453 CreateTestTabContents(browser); |
454 browser->ShowFindBar(); | 454 browser->ShowFindBar(); |
455 ASSERT_TRUE(browser->GetFindBarController()->find_bar()->IsFindBarVisible()); | 455 ASSERT_TRUE(browser->GetFindBarController()->find_bar()->IsFindBarVisible()); |
456 panel->Close(); | 456 panel->Close(); |
457 } | 457 } |
458 | 458 |
459 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DragOnePanel) { | 459 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DragOnePanel) { |
460 static const int num_panels = 1; | 460 static const int num_panels = 1; |
461 static const int zero_delta = 0; | 461 static const int zero_delta = 0; |
462 static const int big_delta = 70; | 462 static const int big_delta_x = 70; |
| 463 static const int big_delta_y = 30; // Do not exceed the threshold to detach. |
463 | 464 |
464 static const std::vector<int> zero_deltas(num_panels, zero_delta); | 465 static const std::vector<int> zero_deltas(num_panels, zero_delta); |
465 std::vector<int> expected_delta_x_after_drag(num_panels, zero_delta); | 466 std::vector<int> expected_delta_x_after_drag(num_panels, zero_delta); |
466 std::vector<int> expected_delta_x_after_finish(num_panels, zero_delta); | 467 std::vector<int> expected_delta_x_after_finish(num_panels, zero_delta); |
467 | 468 |
468 Panel* panel1 = | 469 Panel* panel1 = |
469 CreatePanelWithBounds("PanelTest1", gfx::Rect(0, 0, 100, 100)); | 470 CreatePanelWithBounds("PanelTest1", gfx::Rect(0, 0, 100, 100)); |
470 | 471 |
471 // Drag left. | 472 // Drag left. |
472 expected_delta_x_after_drag[0] = -big_delta; | 473 expected_delta_x_after_drag[0] = -big_delta_x; |
473 expected_delta_x_after_finish = zero_deltas; | 474 expected_delta_x_after_finish = zero_deltas; |
474 TestDragging(-big_delta, zero_delta, 0, expected_delta_x_after_drag, | 475 TestDragging(-big_delta_x, zero_delta, 0, expected_delta_x_after_drag, |
475 zero_deltas, GetAllPanelBounds(), | 476 zero_deltas, GetAllPanelBounds(), |
476 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); | 477 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); |
477 | 478 |
478 // Drag left and cancel. | 479 // Drag left and cancel. |
479 expected_delta_x_after_drag[0] = -big_delta; | 480 expected_delta_x_after_drag[0] = -big_delta_x; |
480 expected_delta_x_after_finish = zero_deltas; | 481 expected_delta_x_after_finish = zero_deltas; |
481 TestDragging(-big_delta, zero_delta, 0, expected_delta_x_after_drag, | 482 TestDragging(-big_delta_x, zero_delta, 0, expected_delta_x_after_drag, |
482 zero_deltas, GetAllPanelBounds(), | 483 zero_deltas, GetAllPanelBounds(), |
483 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL); | 484 DRAG_ACTION_BEGIN | DRAG_ACTION_CANCEL); |
484 | 485 |
485 // Drag right. | 486 // Drag right. |
486 expected_delta_x_after_drag[0] = big_delta; | 487 expected_delta_x_after_drag[0] = big_delta_x; |
487 TestDragging(big_delta, zero_delta, 0, expected_delta_x_after_drag, | 488 TestDragging(big_delta_x, zero_delta, 0, expected_delta_x_after_drag, |
488 zero_deltas, GetAllPanelBounds(), | 489 zero_deltas, GetAllPanelBounds(), |
489 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); | 490 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); |
490 | 491 |
491 // Drag right and up. Expect no vertical movement. | 492 // Drag right and up. Expect no vertical movement. |
492 TestDragging(big_delta, big_delta, 0, expected_delta_x_after_drag, | 493 TestDragging(big_delta_x, big_delta_y, 0, expected_delta_x_after_drag, |
493 zero_deltas, GetAllPanelBounds(), | 494 zero_deltas, GetAllPanelBounds(), |
494 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); | 495 DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); |
495 | 496 |
496 // Drag up. Expect no movement on drag. | 497 // Drag up. Expect no movement on drag. |
497 TestDragging(0, -big_delta, 0, zero_deltas, zero_deltas, | 498 TestDragging(0, -big_delta_y, 0, zero_deltas, zero_deltas, |
498 GetAllPanelBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); | 499 GetAllPanelBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); |
499 | 500 |
500 // Drag down. Expect no movement on drag. | 501 // Drag down. Expect no movement on drag. |
501 TestDragging(0, big_delta, 0, zero_deltas, zero_deltas, | 502 TestDragging(0, big_delta_y, 0, zero_deltas, zero_deltas, |
502 GetAllPanelBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); | 503 GetAllPanelBounds(), DRAG_ACTION_BEGIN | DRAG_ACTION_FINISH); |
503 | 504 |
504 panel1->Close(); | 505 panel1->Close(); |
505 } | 506 } |
506 | 507 |
507 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DragTwoPanels) { | 508 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DragTwoPanels) { |
508 static const int num_panels = 2; | 509 static const int num_panels = 2; |
509 static const int zero_delta = 0; | 510 static const int zero_delta = 0; |
510 static const int small_delta = 10; | 511 static const int small_delta = 10; |
511 static const int big_delta = 70; | 512 static const int big_delta = 70; |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 // position when tall panel brings up its titlebar. | 2192 // position when tall panel brings up its titlebar. |
2192 CloseWindowAndWait(panel1->browser()); | 2193 CloseWindowAndWait(panel1->browser()); |
2193 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 2194 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
2194 GetBalloonBottomPosition(balloon)); | 2195 GetBalloonBottomPosition(balloon)); |
2195 | 2196 |
2196 // Closing the remaining tall panel should move the notification balloon back | 2197 // Closing the remaining tall panel should move the notification balloon back |
2197 // to its original position. | 2198 // to its original position. |
2198 CloseWindowAndWait(panel2->browser()); | 2199 CloseWindowAndWait(panel2->browser()); |
2199 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 2200 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
2200 } | 2201 } |
OLD | NEW |