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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ash/shelf/shelf_widget.h" | 22 #include "ash/shelf/shelf_widget.h" |
23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
24 #include "ash/shell_window_ids.h" | 24 #include "ash/shell_window_ids.h" |
25 #include "ash/test/ash_test_base.h" | 25 #include "ash/test/ash_test_base.h" |
26 #include "ash/test/overflow_bubble_view_test_api.h" | 26 #include "ash/test/overflow_bubble_view_test_api.h" |
27 #include "ash/test/shelf_test_api.h" | 27 #include "ash/test/shelf_test_api.h" |
28 #include "ash/test/shelf_view_test_api.h" | 28 #include "ash/test/shelf_view_test_api.h" |
29 #include "ash/test/shell_test_api.h" | 29 #include "ash/test/shell_test_api.h" |
30 #include "ash/test/test_shelf_delegate.h" | 30 #include "ash/test/test_shelf_delegate.h" |
31 #include "ash/test/test_shelf_item_delegate.h" | 31 #include "ash/test/test_shelf_item_delegate.h" |
| 32 #include "ash/wm/coordinate_conversion.h" |
32 #include "base/basictypes.h" | 33 #include "base/basictypes.h" |
33 #include "base/command_line.h" | 34 #include "base/command_line.h" |
34 #include "base/compiler_specific.h" | 35 #include "base/compiler_specific.h" |
35 #include "base/memory/scoped_ptr.h" | 36 #include "base/memory/scoped_ptr.h" |
36 #include "base/strings/string_number_conversions.h" | 37 #include "base/strings/string_number_conversions.h" |
37 #include "grit/ash_resources.h" | 38 #include "grit/ash_resources.h" |
38 #include "ui/aura/test/aura_test_base.h" | 39 #include "ui/aura/test/aura_test_base.h" |
39 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
40 #include "ui/aura/window_event_dispatcher.h" | 41 #include "ui/aura/window_event_dispatcher.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/compositor/layer.h" | 43 #include "ui/compositor/layer.h" |
43 #include "ui/events/event.h" | 44 #include "ui/events/event.h" |
44 #include "ui/events/event_constants.h" | 45 #include "ui/events/event_constants.h" |
45 #include "ui/events/test/event_generator.h" | 46 #include "ui/events/test/event_generator.h" |
46 #include "ui/views/view_model.h" | 47 #include "ui/views/view_model.h" |
47 #include "ui/views/widget/widget.h" | 48 #include "ui/views/widget/widget.h" |
48 #include "ui/views/widget/widget_delegate.h" | 49 #include "ui/views/widget/widget_delegate.h" |
49 #include "ui/wm/core/coordinate_conversion.h" | |
50 | 50 |
51 namespace ash { | 51 namespace ash { |
52 namespace test { | 52 namespace test { |
53 | 53 |
54 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
55 // ShelfIconObserver tests. | 55 // ShelfIconObserver tests. |
56 | 56 |
57 class TestShelfIconObserver : public ShelfIconObserver { | 57 class TestShelfIconObserver : public ShelfIconObserver { |
58 public: | 58 public: |
59 explicit TestShelfIconObserver(Shelf* shelf) | 59 explicit TestShelfIconObserver(Shelf* shelf) |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 Shelf* secondary_shelf = Shelf::ForWindow(second_root); | 1597 Shelf* secondary_shelf = Shelf::ForWindow(second_root); |
1598 ShelfView* shelf_view_for_secondary = | 1598 ShelfView* shelf_view_for_secondary = |
1599 ShelfTestAPI(secondary_shelf).shelf_view(); | 1599 ShelfTestAPI(secondary_shelf).shelf_view(); |
1600 | 1600 |
1601 ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary); | 1601 ShelfViewTestAPI test_api_for_secondary_shelf_view(shelf_view_for_secondary); |
1602 ShelfButton* button = | 1602 ShelfButton* button = |
1603 test_api_for_secondary_shelf_view.GetButton(browser_index); | 1603 test_api_for_secondary_shelf_view.GetButton(browser_index); |
1604 | 1604 |
1605 // Fetch the start point of dragging. | 1605 // Fetch the start point of dragging. |
1606 gfx::Point start_point = button->GetBoundsInScreen().CenterPoint(); | 1606 gfx::Point start_point = button->GetBoundsInScreen().CenterPoint(); |
1607 ::wm::ConvertPointFromScreen(second_root, &start_point); | 1607 wm::ConvertPointFromScreen(second_root, &start_point); |
1608 | 1608 |
1609 ui::test::EventGenerator generator(second_root, start_point); | 1609 ui::test::EventGenerator generator(second_root, start_point); |
1610 | 1610 |
1611 // Rip off the browser item. | 1611 // Rip off the browser item. |
1612 generator.PressLeftButton(); | 1612 generator.PressLeftButton(); |
1613 generator.MoveMouseTo(start_point.x() + 400, start_point.y()); | 1613 generator.MoveMouseTo(start_point.x() + 400, start_point.y()); |
1614 test_api_for_secondary_shelf_view.RunMessageLoopUntilAnimationsDone(); | 1614 test_api_for_secondary_shelf_view.RunMessageLoopUntilAnimationsDone(); |
1615 EXPECT_TRUE(test_api_for_secondary_shelf_view.IsRippedOffFromShelf()); | 1615 EXPECT_TRUE(test_api_for_secondary_shelf_view.IsRippedOffFromShelf()); |
1616 } | 1616 } |
1617 | 1617 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1669 test_api_->RunMessageLoopUntilAnimationsDone(); | 1669 test_api_->RunMessageLoopUntilAnimationsDone(); |
1670 CheckAllItemsAreInBounds(); | 1670 CheckAllItemsAreInBounds(); |
1671 } | 1671 } |
1672 | 1672 |
1673 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1673 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
1674 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1674 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
1675 testing::Bool()); | 1675 testing::Bool()); |
1676 | 1676 |
1677 } // namespace test | 1677 } // namespace test |
1678 } // namespace ash | 1678 } // namespace ash |
OLD | NEW |