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" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ui::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 button_host->PointerPressedOnButton(button, pointer, click_event); |
275 button_host->PointerPressedOnButton(button, pointer, views_click_event); | |
276 | 275 |
277 // Drag. | 276 // Drag. |
278 views::View* destination = test_api_->GetButton(destination_index); | 277 views::View* destination = test_api_->GetButton(destination_index); |
279 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, | 278 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, |
280 destination->bounds().origin(), | 279 destination->bounds().origin(), |
281 destination->bounds().origin(), 0); | 280 destination->bounds().origin(), 0); |
282 views::MouseEvent views_drag_event(&drag_event); | 281 button_host->PointerDraggedOnButton(button, pointer, drag_event); |
283 button_host->PointerDraggedOnButton(button, pointer, views_drag_event); | |
284 return button; | 282 return button; |
285 } | 283 } |
286 | 284 |
287 void SetupForDragTest( | 285 void SetupForDragTest( |
288 std::vector<std::pair<LauncherID, views::View*> >* id_map) { | 286 std::vector<std::pair<LauncherID, views::View*> >* id_map) { |
289 // Initialize |id_map| with the automatically-created launcher buttons. | 287 // Initialize |id_map| with the automatically-created launcher buttons. |
290 for (size_t i = 0; i < model_->items().size(); ++i) { | 288 for (size_t i = 0; i < model_->items().size(); ++i) { |
291 id_map->push_back(std::make_pair(model_->items()[i].id, | 289 id_map->push_back(std::make_pair(model_->items()[i].id, |
292 test_api_->GetButton(i))); | 290 test_api_->GetButton(i))); |
293 } | 291 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 701 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
704 const gfx::Rect& app_list_ideal_bounds = | 702 const gfx::Rect& app_list_ideal_bounds = |
705 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 703 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
706 const gfx::Rect& app_list_bounds = | 704 const gfx::Rect& app_list_bounds = |
707 test_api_->GetBoundsByIndex(app_list_button_index); | 705 test_api_->GetBoundsByIndex(app_list_button_index); |
708 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); | 706 EXPECT_EQ(app_list_bounds, app_list_ideal_bounds); |
709 } | 707 } |
710 | 708 |
711 } // namespace test | 709 } // namespace test |
712 } // namespace ash | 710 } // namespace ash |
OLD | NEW |