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/launcher/launcher_view.h" | 5 #include "ash/launcher/launcher_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
11 #include "ash/launcher/launcher_button.h" | 11 #include "ash/launcher/launcher_button.h" |
12 #include "ash/launcher/launcher_icon_observer.h" | 12 #include "ash/launcher/launcher_icon_observer.h" |
13 #include "ash/launcher/launcher_model.h" | 13 #include "ash/launcher/launcher_model.h" |
14 #include "ash/launcher/launcher_tooltip_manager.h" | 14 #include "ash/launcher/launcher_tooltip_manager.h" |
15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
17 #include "ash/test/launcher_view_test_api.h" | 17 #include "ash/test/launcher_view_test_api.h" |
18 #include "ash/test/test_launcher_delegate.h" | 18 #include "ash/test/test_launcher_delegate.h" |
19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
20 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "grit/ui_resources.h" | 22 #include "grit/ui_resources.h" |
23 #include "ui/aura/event.h" | |
24 #include "ui/aura/test/aura_test_base.h" | 23 #include "ui/aura/test/aura_test_base.h" |
25 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 25 #include "ui/base/event.h" |
26 #include "ui/base/events.h" | 26 #include "ui/base/events.h" |
27 #include "ui/compositor/layer.h" | 27 #include "ui/compositor/layer.h" |
28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
29 #include "ui/views/widget/widget_delegate.h" | 29 #include "ui/views/widget/widget_delegate.h" |
30 | 30 |
31 namespace ash { | 31 namespace ash { |
32 namespace test { | 32 namespace test { |
33 | 33 |
34 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
35 // LauncherIconObserver tests. | 35 // LauncherIconObserver tests. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 views::View* SimulateDrag(internal::LauncherButtonHost::Pointer pointer, | 264 views::View* SimulateDrag(internal::LauncherButtonHost::Pointer pointer, |
265 int button_index, | 265 int button_index, |
266 int destination_index) { | 266 int destination_index) { |
267 internal::LauncherButtonHost* button_host = launcher_view_.get(); | 267 internal::LauncherButtonHost* button_host = launcher_view_.get(); |
268 | 268 |
269 // Mouse down. | 269 // Mouse down. |
270 views::View* button = test_api_->GetButton(button_index); | 270 views::View* button = test_api_->GetButton(button_index); |
271 aura::MouseEvent click_event(ui::ET_MOUSE_PRESSED, | 271 ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, |
272 button->bounds().origin(), | 272 button->bounds().origin(), |
273 button->bounds().origin(), 0); | 273 button->bounds().origin(), 0); |
274 views::MouseEvent views_click_event(&click_event); | 274 views::MouseEvent views_click_event(&click_event); |
275 button_host->PointerPressedOnButton(button, pointer, views_click_event); | 275 button_host->PointerPressedOnButton(button, pointer, views_click_event); |
276 | 276 |
277 // Drag. | 277 // Drag. |
278 views::View* destination = test_api_->GetButton(destination_index); | 278 views::View* destination = test_api_->GetButton(destination_index); |
279 aura::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, | 279 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, |
280 destination->bounds().origin(), | 280 destination->bounds().origin(), |
281 destination->bounds().origin(), 0); | 281 destination->bounds().origin(), 0); |
282 views::MouseEvent views_drag_event(&drag_event); | 282 views::MouseEvent views_drag_event(&drag_event); |
283 button_host->PointerDraggedOnButton(button, pointer, views_drag_event); | 283 button_host->PointerDraggedOnButton(button, pointer, views_drag_event); |
284 return button; | 284 return button; |
285 } | 285 } |
286 | 286 |
287 void SetupForDragTest( | 287 void SetupForDragTest( |
288 std::vector<std::pair<LauncherID, views::View*> >* id_map) { | 288 std::vector<std::pair<LauncherID, views::View*> >* id_map) { |
289 // Initialize |id_map| with the automatically-created launcher buttons. | 289 // Initialize |id_map| with the automatically-created launcher buttons. |
290 for (size_t i = 0; i < model_->items().size(); ++i) { | 290 for (size_t i = 0; i < model_->items().size(); ++i) { |
291 id_map->push_back(std::make_pair(model_->items()[i].id, | 291 id_map->push_back(std::make_pair(model_->items()[i].id, |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 703 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
704 const gfx::Rect& app_list_ideal_bounds = | 704 const gfx::Rect& app_list_ideal_bounds = |
705 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 705 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
706 const gfx::Rect& app_list_bounds = | 706 const gfx::Rect& app_list_bounds = |
707 test_api_->GetBoundsByIndex(app_list_button_index); | 707 test_api_->GetBoundsByIndex(app_list_button_index); |
708 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 708 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
709 } | 709 } |
710 | 710 |
711 } // namespace test | 711 } // namespace test |
712 } // namespace ash | 712 } // namespace ash |
OLD | NEW |