Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 } 396 }
397 397
398 views::View* SimulateButtonPressed( 398 views::View* SimulateButtonPressed(
399 internal::ShelfButtonHost::Pointer pointer, 399 internal::ShelfButtonHost::Pointer pointer,
400 int button_index) { 400 int button_index) {
401 internal::ShelfButtonHost* button_host = shelf_view_; 401 internal::ShelfButtonHost* button_host = shelf_view_;
402 views::View* button = test_api_->GetButton(button_index); 402 views::View* button = test_api_->GetButton(button_index);
403 ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED, 403 ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED,
404 button->bounds().origin(), 404 button->bounds().origin(),
405 button->GetBoundsInScreen().origin(), 0); 405 button->GetBoundsInScreen().origin(), 0, 0);
406 button_host->PointerPressedOnButton(button, pointer, click_event); 406 button_host->PointerPressedOnButton(button, pointer, click_event);
407 return button; 407 return button;
408 } 408 }
409 409
410 views::View* SimulateClick(internal::ShelfButtonHost::Pointer pointer, 410 views::View* SimulateClick(internal::ShelfButtonHost::Pointer pointer,
411 int button_index) { 411 int button_index) {
412 internal::ShelfButtonHost* button_host = shelf_view_; 412 internal::ShelfButtonHost* button_host = shelf_view_;
413 views::View* button = SimulateButtonPressed(pointer, button_index); 413 views::View* button = SimulateButtonPressed(pointer, button_index);
414 button_host->PointerReleasedOnButton(button, 414 button_host->PointerReleasedOnButton(button,
415 internal::ShelfButtonHost::MOUSE, 415 internal::ShelfButtonHost::MOUSE,
416 false); 416 false);
417 return button; 417 return button;
418 } 418 }
419 419
420 views::View* SimulateDrag(internal::ShelfButtonHost::Pointer pointer, 420 views::View* SimulateDrag(internal::ShelfButtonHost::Pointer pointer,
421 int button_index, 421 int button_index,
422 int destination_index) { 422 int destination_index) {
423 internal::ShelfButtonHost* button_host = shelf_view_; 423 internal::ShelfButtonHost* button_host = shelf_view_;
424 views::View* button = SimulateButtonPressed(pointer, button_index); 424 views::View* button = SimulateButtonPressed(pointer, button_index);
425 425
426 // Drag. 426 // Drag.
427 views::View* destination = test_api_->GetButton(destination_index); 427 views::View* destination = test_api_->GetButton(destination_index);
428 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED, 428 ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED,
429 destination->bounds().origin(), 429 destination->bounds().origin(),
430 destination->GetBoundsInScreen().origin(), 0); 430 destination->GetBoundsInScreen().origin(), 0, 0);
431 button_host->PointerDraggedOnButton(button, pointer, drag_event); 431 button_host->PointerDraggedOnButton(button, pointer, drag_event);
432 return button; 432 return button;
433 } 433 }
434 434
435 void SetupForDragTest( 435 void SetupForDragTest(
436 std::vector<std::pair<LauncherID, views::View*> >* id_map) { 436 std::vector<std::pair<LauncherID, views::View*> >* id_map) {
437 // Initialize |id_map| with the automatically-created launcher buttons. 437 // Initialize |id_map| with the automatically-created launcher buttons.
438 for (size_t i = 0; i < model_->items().size(); ++i) { 438 for (size_t i = 0; i < model_->items().size(); ++i) {
439 internal::ShelfButton* button = test_api_->GetButton(i); 439 internal::ShelfButton* button = test_api_->GetButton(i);
440 id_map->push_back(std::make_pair(model_->items()[i].id, button)); 440 id_map->push_back(std::make_pair(model_->items()[i].id, button));
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 test_api_->RunMessageLoopUntilAnimationsDone(); 1773 test_api_->RunMessageLoopUntilAnimationsDone();
1774 CheckAllItemsAreInBounds(); 1774 CheckAllItemsAreInBounds();
1775 } 1775 }
1776 1776
1777 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1777 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1778 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1778 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1779 testing::Bool()); 1779 testing::Bool());
1780 1780
1781 } // namespace test 1781 } // namespace test
1782 } // namespace ash 1782 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/system/chromeos/screen_security/screen_tray_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698