| 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 "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "base/time/time.h" | 38 #include "base/time/time.h" |
| 39 #include "ui/aura/test/aura_test_base.h" | 39 #include "ui/aura/test/aura_test_base.h" |
| 40 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
| 41 #include "ui/aura/window_event_dispatcher.h" | 41 #include "ui/aura/window_event_dispatcher.h" |
| 42 #include "ui/compositor/layer.h" | 42 #include "ui/compositor/layer.h" |
| 43 #include "ui/events/event.h" | 43 #include "ui/events/event.h" |
| 44 #include "ui/events/event_constants.h" | 44 #include "ui/events/event_constants.h" |
| 45 #include "ui/events/event_utils.h" | 45 #include "ui/events/event_utils.h" |
| 46 #include "ui/events/test/event_generator.h" | 46 #include "ui/events/test/event_generator.h" |
| 47 #include "ui/gfx/geometry/point.h" | 47 #include "ui/gfx/geometry/point.h" |
| 48 #include "ui/views/animation/test/ink_drop_host_view_test_api.h" |
| 48 #include "ui/views/bubble/bubble_frame_view.h" | 49 #include "ui/views/bubble/bubble_frame_view.h" |
| 49 #include "ui/views/view_model.h" | 50 #include "ui/views/view_model.h" |
| 50 #include "ui/views/widget/widget.h" | 51 #include "ui/views/widget/widget.h" |
| 51 #include "ui/views/widget/widget_delegate.h" | 52 #include "ui/views/widget/widget_delegate.h" |
| 52 #include "ui/wm/core/coordinate_conversion.h" | 53 #include "ui/wm/core/coordinate_conversion.h" |
| 53 | 54 |
| 54 namespace ash { | 55 namespace ash { |
| 55 namespace test { | 56 namespace test { |
| 56 | 57 |
| 57 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 shelf_view_->PointerPressedOnButton(button, pointer, click_event); | 462 shelf_view_->PointerPressedOnButton(button, pointer, click_event); |
| 462 return button; | 463 return button; |
| 463 } | 464 } |
| 464 | 465 |
| 465 // Simulates a single mouse click. | 466 // Simulates a single mouse click. |
| 466 void SimulateClick(int button_index) { | 467 void SimulateClick(int button_index) { |
| 467 ShelfButton* button = SimulateButtonPressed(ShelfView::MOUSE, button_index); | 468 ShelfButton* button = SimulateButtonPressed(ShelfView::MOUSE, button_index); |
| 468 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, gfx::Point(), | 469 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, gfx::Point(), |
| 469 button->GetBoundsInScreen().origin(), | 470 button->GetBoundsInScreen().origin(), |
| 470 ui::EventTimeForNow(), 0, 0); | 471 ui::EventTimeForNow(), 0, 0); |
| 471 test_api_->ButtonPressed(button, release_event); | 472 test_api_->ButtonPressed( |
| 473 button, release_event, |
| 474 views::test::InkDropHostViewTestApi(button).ink_drop()); |
| 472 shelf_view_->PointerReleasedOnButton(button, ShelfView::MOUSE, false); | 475 shelf_view_->PointerReleasedOnButton(button, ShelfView::MOUSE, false); |
| 473 } | 476 } |
| 474 | 477 |
| 475 // Simulates the second click of a double click. | 478 // Simulates the second click of a double click. |
| 476 void SimulateDoubleClick(int button_index) { | 479 void SimulateDoubleClick(int button_index) { |
| 477 ShelfButton* button = SimulateButtonPressed(ShelfView::MOUSE, button_index); | 480 ShelfButton* button = SimulateButtonPressed(ShelfView::MOUSE, button_index); |
| 478 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, gfx::Point(), | 481 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, gfx::Point(), |
| 479 button->GetBoundsInScreen().origin(), | 482 button->GetBoundsInScreen().origin(), |
| 480 ui::EventTimeForNow(), ui::EF_IS_DOUBLE_CLICK, | 483 ui::EventTimeForNow(), ui::EF_IS_DOUBLE_CLICK, |
| 481 0); | 484 0); |
| 482 test_api_->ButtonPressed(button, release_event); | 485 test_api_->ButtonPressed( |
| 486 button, release_event, |
| 487 views::test::InkDropHostViewTestApi(button).ink_drop()); |
| 483 shelf_view_->PointerReleasedOnButton(button, ShelfView::MOUSE, false); | 488 shelf_view_->PointerReleasedOnButton(button, ShelfView::MOUSE, false); |
| 484 } | 489 } |
| 485 | 490 |
| 486 void DoDrag(int dist_x, | 491 void DoDrag(int dist_x, |
| 487 int dist_y, | 492 int dist_y, |
| 488 views::View* button, | 493 views::View* button, |
| 489 ShelfView::Pointer pointer, | 494 ShelfView::Pointer pointer, |
| 490 views::View* to) { | 495 views::View* to) { |
| 491 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, gfx::Point(dist_x, dist_y), | 496 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, gfx::Point(dist_x, dist_y), |
| 492 to->GetBoundsInScreen().origin(), | 497 to->GetBoundsInScreen().origin(), |
| (...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 test_api_->RunMessageLoopUntilAnimationsDone(); | 1987 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1983 CheckAllItemsAreInBounds(); | 1988 CheckAllItemsAreInBounds(); |
| 1984 } | 1989 } |
| 1985 | 1990 |
| 1986 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1991 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
| 1987 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1992 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
| 1988 testing::Bool()); | 1993 testing::Bool()); |
| 1989 | 1994 |
| 1990 } // namespace test | 1995 } // namespace test |
| 1991 } // namespace ash | 1996 } // namespace ash |
| OLD | NEW |