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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 298813002: views: Move MenuButton from TextButton to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable DragDirectlyToSecondWindow. Created 6 years, 6 months 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // 293 //
294 // This code looks a bit hacky, but I've written it so that it shouldn't 294 // This code looks a bit hacky, but I've written it so that it shouldn't
295 // be dependant upon any of the layout code in BookmarkBarView. Instead 295 // be dependant upon any of the layout code in BookmarkBarView. Instead
296 // we brute force search for a size that triggers the overflow button. 296 // we brute force search for a size that triggers the overflow button.
297 views::View tmp_parent; 297 views::View tmp_parent;
298 298
299 tmp_parent.AddChildView(bb_view_.get()); 299 tmp_parent.AddChildView(bb_view_.get());
300 300
301 bb_view_pref_ = bb_view_->GetPreferredSize(); 301 bb_view_pref_ = bb_view_->GetPreferredSize();
302 bb_view_pref_.set_width(1000); 302 bb_view_pref_.set_width(1000);
303 views::TextButton* button = GetBookmarkButton(6); 303 views::LabelButton* button = GetBookmarkButton(6);
304 while (button->visible()) { 304 while (button->visible()) {
305 bb_view_pref_.set_width(bb_view_pref_.width() - 25); 305 bb_view_pref_.set_width(bb_view_pref_.width() - 25);
306 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height()); 306 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height());
307 bb_view_->Layout(); 307 bb_view_->Layout();
308 } 308 }
309 309
310 tmp_parent.RemoveChildView(bb_view_.get()); 310 tmp_parent.RemoveChildView(bb_view_.get());
311 311
312 ViewEventTestBase::SetUp(); 312 ViewEventTestBase::SetUp();
313 } 313 }
(...skipping 21 matching lines...) Expand all
335 content::SetContentClient(NULL); 335 content::SetContentClient(NULL);
336 } 336 }
337 337
338 protected: 338 protected:
339 virtual views::View* CreateContentsView() OVERRIDE { 339 virtual views::View* CreateContentsView() OVERRIDE {
340 return bb_view_.get(); 340 return bb_view_.get();
341 } 341 }
342 342
343 virtual gfx::Size GetPreferredSize() const OVERRIDE { return bb_view_pref_; } 343 virtual gfx::Size GetPreferredSize() const OVERRIDE { return bb_view_pref_; }
344 344
345 views::TextButton* GetBookmarkButton(int view_index) { 345 views::LabelButton* GetBookmarkButton(int view_index) {
346 return bb_view_->GetBookmarkButton(view_index); 346 return bb_view_->GetBookmarkButton(view_index);
347 } 347 }
348 348
349 // See comment above class description for what this does. 349 // See comment above class description for what this does.
350 virtual bool CreateBigMenu() { return false; } 350 virtual bool CreateBigMenu() { return false; }
351 351
352 BookmarkModel* model_; 352 BookmarkModel* model_;
353 scoped_ptr<BookmarkBarView> bb_view_; 353 scoped_ptr<BookmarkBarView> bb_view_;
354 TestingPageNavigator navigator_; 354 TestingPageNavigator navigator_;
355 355
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 scoped_ptr<ScopedTestingLocalState> local_state_; 394 scoped_ptr<ScopedTestingLocalState> local_state_;
395 }; 395 };
396 396
397 // Clicks on first menu, makes sure button is depressed. Moves mouse to first 397 // Clicks on first menu, makes sure button is depressed. Moves mouse to first
398 // child, clicks it and makes sure a navigation occurs. 398 // child, clicks it and makes sure a navigation occurs.
399 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase { 399 class BookmarkBarViewTest1 : public BookmarkBarViewEventTestBase {
400 protected: 400 protected:
401 virtual void DoTestOnMessageLoop() OVERRIDE { 401 virtual void DoTestOnMessageLoop() OVERRIDE {
402 // Move the mouse to the first folder on the bookmark bar and press the 402 // Move the mouse to the first folder on the bookmark bar and press the
403 // mouse. 403 // mouse.
404 views::TextButton* button = GetBookmarkButton(0); 404 views::LabelButton* button = GetBookmarkButton(0);
405 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 405 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
406 ui_controls::DOWN | ui_controls::UP, 406 ui_controls::DOWN | ui_controls::UP,
407 CreateEventTask(this, &BookmarkBarViewTest1::Step2)); 407 CreateEventTask(this, &BookmarkBarViewTest1::Step2));
408 } 408 }
409 409
410 private: 410 private:
411 void Step2() { 411 void Step2() {
412 // Menu should be showing. 412 // Menu should be showing.
413 views::MenuItemView* menu = bb_view_->GetMenu(); 413 views::MenuItemView* menu = bb_view_->GetMenu();
414 ASSERT_TRUE(menu != NULL); 414 ASSERT_TRUE(menu != NULL);
415 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 415 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
416 416
417 // Button should be depressed. 417 // Button should be depressed.
418 views::TextButton* button = GetBookmarkButton(0); 418 views::LabelButton* button = GetBookmarkButton(0);
419 ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED); 419 ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED);
420 420
421 // Click on the 2nd menu item (A URL). 421 // Click on the 2nd menu item (A URL).
422 ASSERT_TRUE(menu->GetSubmenu()); 422 ASSERT_TRUE(menu->GetSubmenu());
423 423
424 views::MenuItemView* menu_to_select = 424 views::MenuItemView* menu_to_select =
425 menu->GetSubmenu()->GetMenuItemAt(0); 425 menu->GetSubmenu()->GetMenuItemAt(0);
426 ui_test_utils::MoveMouseToCenterAndPress(menu_to_select, ui_controls::LEFT, 426 ui_test_utils::MoveMouseToCenterAndPress(menu_to_select, ui_controls::LEFT,
427 ui_controls::DOWN | ui_controls::UP, 427 ui_controls::DOWN | ui_controls::UP,
428 CreateEventTask(this, &BookmarkBarViewTest1::Step3)); 428 CreateEventTask(this, &BookmarkBarViewTest1::Step3));
429 } 429 }
430 430
431 void Step3() { 431 void Step3() {
432 // We should have navigated to URL f1a. 432 // We should have navigated to URL f1a.
433 ASSERT_TRUE(navigator_.url_ == 433 ASSERT_TRUE(navigator_.url_ ==
434 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url()); 434 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url());
435 435
436 // Make sure button is no longer pushed. 436 // Make sure button is no longer pushed.
437 views::TextButton* button = GetBookmarkButton(0); 437 views::LabelButton* button = GetBookmarkButton(0);
438 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL); 438 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL);
439 439
440 views::MenuItemView* menu = bb_view_->GetMenu(); 440 views::MenuItemView* menu = bb_view_->GetMenu();
441 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing()); 441 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing());
442 442
443 Done(); 443 Done();
444 } 444 }
445 }; 445 };
446 446
447 VIEW_TEST(BookmarkBarViewTest1, Basic) 447 VIEW_TEST(BookmarkBarViewTest1, Basic)
448 448
449 // Brings up menu, clicks on empty space and make sure menu hides. 449 // Brings up menu, clicks on empty space and make sure menu hides.
450 class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase { 450 class BookmarkBarViewTest2 : public BookmarkBarViewEventTestBase {
451 protected: 451 protected:
452 virtual void DoTestOnMessageLoop() OVERRIDE { 452 virtual void DoTestOnMessageLoop() OVERRIDE {
453 // Move the mouse to the first folder on the bookmark bar and press the 453 // Move the mouse to the first folder on the bookmark bar and press the
454 // mouse. 454 // mouse.
455 views::TextButton* button = GetBookmarkButton(0); 455 views::LabelButton* button = GetBookmarkButton(0);
456 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 456 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
457 ui_controls::DOWN | ui_controls::UP, 457 ui_controls::DOWN | ui_controls::UP,
458 CreateEventTask(this, &BookmarkBarViewTest2::Step2)); 458 CreateEventTask(this, &BookmarkBarViewTest2::Step2));
459 } 459 }
460 460
461 private: 461 private:
462 void Step2() { 462 void Step2() {
463 // Menu should be showing. 463 // Menu should be showing.
464 views::MenuItemView* menu = bb_view_->GetMenu(); 464 views::MenuItemView* menu = bb_view_->GetMenu();
465 ASSERT_TRUE(menu != NULL && menu->GetSubmenu()->IsShowing()); 465 ASSERT_TRUE(menu != NULL && menu->GetSubmenu()->IsShowing());
(...skipping 17 matching lines...) Expand all
483 CreateEventTask(this, &BookmarkBarViewTest2::Step4)); 483 CreateEventTask(this, &BookmarkBarViewTest2::Step4));
484 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP); 484 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP);
485 } 485 }
486 486
487 void Step4() { 487 void Step4() {
488 // The menu shouldn't be showing. 488 // The menu shouldn't be showing.
489 views::MenuItemView* menu = bb_view_->GetMenu(); 489 views::MenuItemView* menu = bb_view_->GetMenu();
490 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing()); 490 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing());
491 491
492 // Make sure button is no longer pushed. 492 // Make sure button is no longer pushed.
493 views::TextButton* button = GetBookmarkButton(0); 493 views::LabelButton* button = GetBookmarkButton(0);
494 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL); 494 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL);
495 495
496 Done(); 496 Done();
497 } 497 }
498 }; 498 };
499 499
500 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 500 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
501 // TODO(erg): linux_aura bringup: http://crbug.com/163931 501 // TODO(erg): linux_aura bringup: http://crbug.com/163931
502 #define MAYBE_HideOnDesktopClick DISABLED_HideOnDesktopClick 502 #define MAYBE_HideOnDesktopClick DISABLED_HideOnDesktopClick
503 #else 503 #else
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { 613 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase {
614 public: 614 public:
615 BookmarkBarViewTest4() 615 BookmarkBarViewTest4()
616 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) { 616 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) {
617 } 617 }
618 618
619 protected: 619 protected:
620 virtual void DoTestOnMessageLoop() OVERRIDE { 620 virtual void DoTestOnMessageLoop() OVERRIDE {
621 // Move the mouse to the first folder on the bookmark bar and press the 621 // Move the mouse to the first folder on the bookmark bar and press the
622 // mouse. 622 // mouse.
623 views::TextButton* button = bb_view_->other_bookmarked_button(); 623 views::LabelButton* button = bb_view_->other_bookmarked_button();
624 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 624 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
625 ui_controls::DOWN | ui_controls::UP, 625 ui_controls::DOWN | ui_controls::UP,
626 CreateEventTask(this, &BookmarkBarViewTest4::Step2)); 626 CreateEventTask(this, &BookmarkBarViewTest4::Step2));
627 } 627 }
628 628
629 private: 629 private:
630 void Step2() { 630 void Step2() {
631 // Menu should be showing. 631 // Menu should be showing.
632 views::MenuItemView* menu = bb_view_->GetMenu(); 632 views::MenuItemView* menu = bb_view_->GetMenu();
633 ASSERT_TRUE(menu != NULL); 633 ASSERT_TRUE(menu != NULL);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 669
670 // Tests drag and drop within the same menu. 670 // Tests drag and drop within the same menu.
671 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { 671 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase {
672 protected: 672 protected:
673 virtual void DoTestOnMessageLoop() OVERRIDE { 673 virtual void DoTestOnMessageLoop() OVERRIDE {
674 url_dragging_ = 674 url_dragging_ =
675 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); 675 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url();
676 676
677 // Move the mouse to the first folder on the bookmark bar and press the 677 // Move the mouse to the first folder on the bookmark bar and press the
678 // mouse. 678 // mouse.
679 views::TextButton* button = GetBookmarkButton(0); 679 views::LabelButton* button = GetBookmarkButton(0);
680 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 680 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
681 ui_controls::DOWN | ui_controls::UP, 681 ui_controls::DOWN | ui_controls::UP,
682 CreateEventTask(this, &BookmarkBarViewTest5::Step2)); 682 CreateEventTask(this, &BookmarkBarViewTest5::Step2));
683 } 683 }
684 684
685 private: 685 private:
686 void Step2() { 686 void Step2() {
687 // Menu should be showing. 687 // Menu should be showing.
688 views::MenuItemView* menu = bb_view_->GetMenu(); 688 views::MenuItemView* menu = bb_view_->GetMenu();
689 ASSERT_TRUE(menu != NULL); 689 ASSERT_TRUE(menu != NULL);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 }; 736 };
737 737
738 VIEW_TEST(BookmarkBarViewTest5, MAYBE(DND)) 738 VIEW_TEST(BookmarkBarViewTest5, MAYBE(DND))
739 739
740 // Tests holding mouse down on overflow button, dragging such that menu pops up 740 // Tests holding mouse down on overflow button, dragging such that menu pops up
741 // then selecting an item. 741 // then selecting an item.
742 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { 742 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase {
743 protected: 743 protected:
744 virtual void DoTestOnMessageLoop() OVERRIDE { 744 virtual void DoTestOnMessageLoop() OVERRIDE {
745 // Press the mouse button on the overflow button. Don't release it though. 745 // Press the mouse button on the overflow button. Don't release it though.
746 views::TextButton* button = bb_view_->overflow_button(); 746 views::LabelButton* button = bb_view_->overflow_button();
747 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 747 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
748 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); 748 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2));
749 } 749 }
750 750
751 private: 751 private:
752 void Step2() { 752 void Step2() {
753 // Menu should be showing. 753 // Menu should be showing.
754 views::MenuItemView* menu = bb_view_->GetMenu(); 754 views::MenuItemView* menu = bb_view_->GetMenu();
755 ASSERT_TRUE(menu != NULL); 755 ASSERT_TRUE(menu != NULL);
756 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 756 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
(...skipping 20 matching lines...) Expand all
777 777
778 // Tests drag and drop to different menu. 778 // Tests drag and drop to different menu.
779 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { 779 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase {
780 protected: 780 protected:
781 virtual void DoTestOnMessageLoop() OVERRIDE { 781 virtual void DoTestOnMessageLoop() OVERRIDE {
782 url_dragging_ = 782 url_dragging_ =
783 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); 783 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url();
784 784
785 // Move the mouse to the first folder on the bookmark bar and press the 785 // Move the mouse to the first folder on the bookmark bar and press the
786 // mouse. 786 // mouse.
787 views::TextButton* button = GetBookmarkButton(0); 787 views::LabelButton* button = GetBookmarkButton(0);
788 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 788 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
789 ui_controls::DOWN | ui_controls::UP, 789 ui_controls::DOWN | ui_controls::UP,
790 CreateEventTask(this, &BookmarkBarViewTest7::Step2)); 790 CreateEventTask(this, &BookmarkBarViewTest7::Step2));
791 } 791 }
792 792
793 private: 793 private:
794 void Step2() { 794 void Step2() {
795 // Menu should be showing. 795 // Menu should be showing.
796 views::MenuItemView* menu = bb_view_->GetMenu(); 796 views::MenuItemView* menu = bb_view_->GetMenu();
797 ASSERT_TRUE(menu != NULL); 797 ASSERT_TRUE(menu != NULL);
798 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 798 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
799 799
800 views::MenuItemView* child_menu = 800 views::MenuItemView* child_menu =
801 menu->GetSubmenu()->GetMenuItemAt(0); 801 menu->GetSubmenu()->GetMenuItemAt(0);
802 ASSERT_TRUE(child_menu != NULL); 802 ASSERT_TRUE(child_menu != NULL);
803 803
804 // Move mouse to center of menu and press button. 804 // Move mouse to center of menu and press button.
805 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT, 805 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT,
806 ui_controls::DOWN, 806 ui_controls::DOWN,
807 CreateEventTask(this, &BookmarkBarViewTest7::Step3)); 807 CreateEventTask(this, &BookmarkBarViewTest7::Step3));
808 } 808 }
809 809
810 void Step3() { 810 void Step3() {
811 // Drag over other button. 811 // Drag over other button.
812 views::TextButton* other_button = 812 views::LabelButton* other_button =
813 bb_view_->other_bookmarked_button(); 813 bb_view_->other_bookmarked_button();
814 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 814 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
815 views::View::ConvertPointToScreen(other_button, &loc); 815 views::View::ConvertPointToScreen(other_button, &loc);
816 816
817 #if defined(USE_AURA) 817 #if defined(USE_AURA)
818 // TODO: fix this. Aura requires an additional mouse event to trigger drag 818 // TODO: fix this. Aura requires an additional mouse event to trigger drag
819 // and drop checking state. 819 // and drop checking state.
820 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 820 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
821 base::Bind(&BookmarkBarViewTest7::Step3A, this)); 821 base::Bind(&BookmarkBarViewTest7::Step3A, this));
822 #else 822 #else
823 // Start a drag. 823 // Start a drag.
824 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 824 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
825 base::Bind(&BookmarkBarViewTest7::Step4, this)); 825 base::Bind(&BookmarkBarViewTest7::Step4, this));
826 826
827 // See comment above this method as to why we do this. 827 // See comment above this method as to why we do this.
828 ScheduleMouseMoveInBackground(loc.x(), loc.y()); 828 ScheduleMouseMoveInBackground(loc.x(), loc.y());
829 #endif 829 #endif
830 } 830 }
831 831
832 void Step3A() { 832 void Step3A() {
833 // Drag over other button. 833 // Drag over other button.
834 views::TextButton* other_button = 834 views::LabelButton* other_button =
835 bb_view_->other_bookmarked_button(); 835 bb_view_->other_bookmarked_button();
836 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 836 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
837 views::View::ConvertPointToScreen(other_button, &loc); 837 views::View::ConvertPointToScreen(other_button, &loc);
838 838
839 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(), 839 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(),
840 base::Bind(&BookmarkBarViewTest7::Step4, this)); 840 base::Bind(&BookmarkBarViewTest7::Step4, this));
841 } 841 }
842 842
843 void Step4() { 843 void Step4() {
844 views::MenuItemView* drop_menu = bb_view_->GetDropMenu(); 844 views::MenuItemView* drop_menu = bb_view_->GetDropMenu();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // Drags from one menu to next so that original menu closes, then back to 877 // Drags from one menu to next so that original menu closes, then back to
878 // original menu. 878 // original menu.
879 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { 879 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase {
880 protected: 880 protected:
881 virtual void DoTestOnMessageLoop() OVERRIDE { 881 virtual void DoTestOnMessageLoop() OVERRIDE {
882 url_dragging_ = 882 url_dragging_ =
883 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); 883 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url();
884 884
885 // Move the mouse to the first folder on the bookmark bar and press the 885 // Move the mouse to the first folder on the bookmark bar and press the
886 // mouse. 886 // mouse.
887 views::TextButton* button = GetBookmarkButton(0); 887 views::LabelButton* button = GetBookmarkButton(0);
888 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 888 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
889 ui_controls::DOWN | ui_controls::UP, 889 ui_controls::DOWN | ui_controls::UP,
890 CreateEventTask(this, &BookmarkBarViewTest8::Step2)); 890 CreateEventTask(this, &BookmarkBarViewTest8::Step2));
891 } 891 }
892 892
893 private: 893 private:
894 void Step2() { 894 void Step2() {
895 // Menu should be showing. 895 // Menu should be showing.
896 views::MenuItemView* menu = bb_view_->GetMenu(); 896 views::MenuItemView* menu = bb_view_->GetMenu();
897 ASSERT_TRUE(menu != NULL); 897 ASSERT_TRUE(menu != NULL);
898 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 898 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
899 899
900 views::MenuItemView* child_menu = 900 views::MenuItemView* child_menu =
901 menu->GetSubmenu()->GetMenuItemAt(0); 901 menu->GetSubmenu()->GetMenuItemAt(0);
902 ASSERT_TRUE(child_menu != NULL); 902 ASSERT_TRUE(child_menu != NULL);
903 903
904 // Move mouse to center of menu and press button. 904 // Move mouse to center of menu and press button.
905 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT, 905 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT,
906 ui_controls::DOWN, 906 ui_controls::DOWN,
907 CreateEventTask(this, &BookmarkBarViewTest8::Step3)); 907 CreateEventTask(this, &BookmarkBarViewTest8::Step3));
908 } 908 }
909 909
910 void Step3() { 910 void Step3() {
911 // Drag over other button. 911 // Drag over other button.
912 views::TextButton* other_button = 912 views::LabelButton* other_button =
913 bb_view_->other_bookmarked_button(); 913 bb_view_->other_bookmarked_button();
914 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 914 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
915 views::View::ConvertPointToScreen(other_button, &loc); 915 views::View::ConvertPointToScreen(other_button, &loc);
916 916
917 // Start a drag. 917 // Start a drag.
918 #if defined(USE_AURA) 918 #if defined(USE_AURA)
919 // TODO: fix this. Aura requires an additional mouse event to trigger drag 919 // TODO: fix this. Aura requires an additional mouse event to trigger drag
920 // and drop checking state. 920 // and drop checking state.
921 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 921 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
922 base::Bind(&BookmarkBarViewTest8::Step3A, this)); 922 base::Bind(&BookmarkBarViewTest8::Step3A, this));
923 #else 923 #else
924 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 924 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
925 base::Bind(&BookmarkBarViewTest8::Step4, this)); 925 base::Bind(&BookmarkBarViewTest8::Step4, this));
926 // See comment above this method as to why we do this. 926 // See comment above this method as to why we do this.
927 ScheduleMouseMoveInBackground(loc.x(), loc.y()); 927 ScheduleMouseMoveInBackground(loc.x(), loc.y());
928 #endif 928 #endif
929 } 929 }
930 930
931 void Step3A() { 931 void Step3A() {
932 // Drag over other button. 932 // Drag over other button.
933 views::TextButton* other_button = 933 views::LabelButton* other_button =
934 bb_view_->other_bookmarked_button(); 934 bb_view_->other_bookmarked_button();
935 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 935 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
936 views::View::ConvertPointToScreen(other_button, &loc); 936 views::View::ConvertPointToScreen(other_button, &loc);
937 937
938 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 938 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
939 base::Bind(&BookmarkBarViewTest8::Step4, this)); 939 base::Bind(&BookmarkBarViewTest8::Step4, this));
940 } 940 }
941 941
942 void Step4() { 942 void Step4() {
943 views::MenuItemView* drop_menu = bb_view_->GetDropMenu(); 943 views::MenuItemView* drop_menu = bb_view_->GetDropMenu();
944 ASSERT_TRUE(drop_menu != NULL); 944 ASSERT_TRUE(drop_menu != NULL);
945 ASSERT_TRUE(drop_menu->GetSubmenu()->IsShowing()); 945 ASSERT_TRUE(drop_menu->GetSubmenu()->IsShowing());
946 946
947 // Now drag back over first menu. 947 // Now drag back over first menu.
948 views::TextButton* button = GetBookmarkButton(0); 948 views::LabelButton* button = GetBookmarkButton(0);
949 gfx::Point loc(button->width() / 2, button->height() / 2); 949 gfx::Point loc(button->width() / 2, button->height() / 2);
950 views::View::ConvertPointToScreen(button, &loc); 950 views::View::ConvertPointToScreen(button, &loc);
951 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(), 951 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(),
952 base::Bind(&BookmarkBarViewTest8::Step5, this)); 952 base::Bind(&BookmarkBarViewTest8::Step5, this));
953 } 953 }
954 954
955 void Step5() { 955 void Step5() {
956 // Drop on folder F11. 956 // Drop on folder F11.
957 views::MenuItemView* drop_menu = bb_view_->GetDropMenu(); 957 views::MenuItemView* drop_menu = bb_view_->GetDropMenu();
958 ASSERT_TRUE(drop_menu != NULL); 958 ASSERT_TRUE(drop_menu != NULL);
(...skipping 25 matching lines...) Expand all
984 #endif 984 #endif
985 985
986 // Moves the mouse over the scroll button and makes sure we get scrolling. 986 // Moves the mouse over the scroll button and makes sure we get scrolling.
987 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { 987 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase {
988 protected: 988 protected:
989 virtual bool CreateBigMenu() OVERRIDE { return true; } 989 virtual bool CreateBigMenu() OVERRIDE { return true; }
990 990
991 virtual void DoTestOnMessageLoop() OVERRIDE { 991 virtual void DoTestOnMessageLoop() OVERRIDE {
992 // Move the mouse to the first folder on the bookmark bar and press the 992 // Move the mouse to the first folder on the bookmark bar and press the
993 // mouse. 993 // mouse.
994 views::TextButton* button = GetBookmarkButton(0); 994 views::LabelButton* button = GetBookmarkButton(0);
995 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 995 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
996 ui_controls::DOWN | ui_controls::UP, 996 ui_controls::DOWN | ui_controls::UP,
997 CreateEventTask(this, &BookmarkBarViewTest9::Step2)); 997 CreateEventTask(this, &BookmarkBarViewTest9::Step2));
998 } 998 }
999 999
1000 private: 1000 private:
1001 void Step2() { 1001 void Step2() {
1002 // Menu should be showing. 1002 // Menu should be showing.
1003 views::MenuItemView* menu = bb_view_->GetMenu(); 1003 views::MenuItemView* menu = bb_view_->GetMenu();
1004 ASSERT_TRUE(menu != NULL); 1004 ASSERT_TRUE(menu != NULL);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 }; 1053 };
1054 1054
1055 VIEW_TEST(BookmarkBarViewTest9, ScrollButtonScrolls) 1055 VIEW_TEST(BookmarkBarViewTest9, ScrollButtonScrolls)
1056 1056
1057 // Tests up/down/left/enter key messages. 1057 // Tests up/down/left/enter key messages.
1058 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { 1058 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase {
1059 protected: 1059 protected:
1060 virtual void DoTestOnMessageLoop() OVERRIDE { 1060 virtual void DoTestOnMessageLoop() OVERRIDE {
1061 // Move the mouse to the first folder on the bookmark bar and press the 1061 // Move the mouse to the first folder on the bookmark bar and press the
1062 // mouse. 1062 // mouse.
1063 views::TextButton* button = GetBookmarkButton(0); 1063 views::LabelButton* button = GetBookmarkButton(0);
1064 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1064 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1065 ui_controls::DOWN | ui_controls::UP, 1065 ui_controls::DOWN | ui_controls::UP,
1066 CreateEventTask(this, &BookmarkBarViewTest10::Step2)); 1066 CreateEventTask(this, &BookmarkBarViewTest10::Step2));
1067 base::MessageLoop::current()->RunUntilIdle(); 1067 base::MessageLoop::current()->RunUntilIdle();
1068 } 1068 }
1069 1069
1070 private: 1070 private:
1071 void Step2() { 1071 void Step2() {
1072 // Menu should be showing. 1072 // Menu should be showing.
1073 views::MenuItemView* menu = bb_view_->GetMenu(); 1073 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { 1167 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase {
1168 public: 1168 public:
1169 BookmarkBarViewTest11() 1169 BookmarkBarViewTest11()
1170 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) { 1170 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) {
1171 } 1171 }
1172 1172
1173 protected: 1173 protected:
1174 virtual void DoTestOnMessageLoop() OVERRIDE { 1174 virtual void DoTestOnMessageLoop() OVERRIDE {
1175 // Move the mouse to the first folder on the bookmark bar and press the 1175 // Move the mouse to the first folder on the bookmark bar and press the
1176 // mouse. 1176 // mouse.
1177 views::TextButton* button = bb_view_->other_bookmarked_button(); 1177 views::LabelButton* button = bb_view_->other_bookmarked_button();
1178 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1178 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1179 ui_controls::DOWN | ui_controls::UP, 1179 ui_controls::DOWN | ui_controls::UP,
1180 CreateEventTask(this, &BookmarkBarViewTest11::Step2)); 1180 CreateEventTask(this, &BookmarkBarViewTest11::Step2));
1181 } 1181 }
1182 1182
1183 private: 1183 private:
1184 void Step2() { 1184 void Step2() {
1185 // Menu should be showing. 1185 // Menu should be showing.
1186 views::MenuItemView* menu = bb_view_->GetMenu(); 1186 views::MenuItemView* menu = bb_view_->GetMenu();
1187 ASSERT_TRUE(menu != NULL); 1187 ASSERT_TRUE(menu != NULL);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu 1242 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu
1243 #endif 1243 #endif
1244 1244
1245 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu) 1245 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu)
1246 1246
1247 // Tests showing a modal dialog from a context menu. 1247 // Tests showing a modal dialog from a context menu.
1248 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { 1248 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase {
1249 protected: 1249 protected:
1250 virtual void DoTestOnMessageLoop() OVERRIDE { 1250 virtual void DoTestOnMessageLoop() OVERRIDE {
1251 // Open up the other folder. 1251 // Open up the other folder.
1252 views::TextButton* button = bb_view_->other_bookmarked_button(); 1252 views::LabelButton* button = bb_view_->other_bookmarked_button();
1253 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1253 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1254 ui_controls::DOWN | ui_controls::UP, 1254 ui_controls::DOWN | ui_controls::UP,
1255 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); 1255 CreateEventTask(this, &BookmarkBarViewTest12::Step2));
1256 chrome::num_bookmark_urls_before_prompting = 1; 1256 chrome::num_bookmark_urls_before_prompting = 1;
1257 } 1257 }
1258 1258
1259 virtual ~BookmarkBarViewTest12() { 1259 virtual ~BookmarkBarViewTest12() {
1260 chrome::num_bookmark_urls_before_prompting = 15; 1260 chrome::num_bookmark_urls_before_prompting = 15;
1261 } 1261 }
1262 1262
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { 1345 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase {
1346 public: 1346 public:
1347 BookmarkBarViewTest13() 1347 BookmarkBarViewTest13()
1348 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) { 1348 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) {
1349 } 1349 }
1350 1350
1351 protected: 1351 protected:
1352 virtual void DoTestOnMessageLoop() OVERRIDE { 1352 virtual void DoTestOnMessageLoop() OVERRIDE {
1353 // Move the mouse to the first folder on the bookmark bar and press the 1353 // Move the mouse to the first folder on the bookmark bar and press the
1354 // mouse. 1354 // mouse.
1355 views::TextButton* button = bb_view_->other_bookmarked_button(); 1355 views::LabelButton* button = bb_view_->other_bookmarked_button();
1356 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1356 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1357 ui_controls::DOWN | ui_controls::UP, 1357 ui_controls::DOWN | ui_controls::UP,
1358 CreateEventTask(this, &BookmarkBarViewTest13::Step2)); 1358 CreateEventTask(this, &BookmarkBarViewTest13::Step2));
1359 } 1359 }
1360 1360
1361 private: 1361 private:
1362 void Step2() { 1362 void Step2() {
1363 // Menu should be showing. 1363 // Menu should be showing.
1364 views::MenuItemView* menu = bb_view_->GetMenu(); 1364 views::MenuItemView* menu = bb_view_->GetMenu();
1365 ASSERT_TRUE(menu != NULL); 1365 ASSERT_TRUE(menu != NULL);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { 1429 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase {
1430 public: 1430 public:
1431 BookmarkBarViewTest14() 1431 BookmarkBarViewTest14()
1432 : observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2)) { 1432 : observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2)) {
1433 } 1433 }
1434 1434
1435 protected: 1435 protected:
1436 virtual void DoTestOnMessageLoop() OVERRIDE { 1436 virtual void DoTestOnMessageLoop() OVERRIDE {
1437 // Move the mouse to the first folder on the bookmark bar and press the 1437 // Move the mouse to the first folder on the bookmark bar and press the
1438 // right mouse button. 1438 // right mouse button.
1439 views::TextButton* button = GetBookmarkButton(0); 1439 views::LabelButton* button = GetBookmarkButton(0);
1440 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT, 1440 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::RIGHT,
1441 ui_controls::DOWN | ui_controls::UP, base::Closure()); 1441 ui_controls::DOWN | ui_controls::UP, base::Closure());
1442 // Step2 will be invoked by BookmarkContextMenuNotificationObserver. 1442 // Step2 will be invoked by BookmarkContextMenuNotificationObserver.
1443 } 1443 }
1444 1444
1445 private: 1445 private:
1446 1446
1447 void Step2() { 1447 void Step2() {
1448 // Menu should NOT be showing. 1448 // Menu should NOT be showing.
1449 views::MenuItemView* menu = bb_view_->GetMenu(); 1449 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 18 matching lines...) Expand all
1468 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { 1468 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase {
1469 public: 1469 public:
1470 BookmarkBarViewTest15() 1470 BookmarkBarViewTest15()
1471 : deleted_menu_id_(0), 1471 : deleted_menu_id_(0),
1472 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) { 1472 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) {
1473 } 1473 }
1474 1474
1475 protected: 1475 protected:
1476 virtual void DoTestOnMessageLoop() OVERRIDE { 1476 virtual void DoTestOnMessageLoop() OVERRIDE {
1477 // Show the other bookmarks. 1477 // Show the other bookmarks.
1478 views::TextButton* button = bb_view_->other_bookmarked_button(); 1478 views::LabelButton* button = bb_view_->other_bookmarked_button();
1479 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1479 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1480 ui_controls::DOWN | ui_controls::UP, 1480 ui_controls::DOWN | ui_controls::UP,
1481 CreateEventTask(this, &BookmarkBarViewTest15::Step2)); 1481 CreateEventTask(this, &BookmarkBarViewTest15::Step2));
1482 } 1482 }
1483 1483
1484 private: 1484 private:
1485 void Step2() { 1485 void Step2() {
1486 // Menu should be showing. 1486 // Menu should be showing.
1487 views::MenuItemView* menu = bb_view_->GetMenu(); 1487 views::MenuItemView* menu = bb_view_->GetMenu();
1488 ASSERT_TRUE(menu != NULL); 1488 ASSERT_TRUE(menu != NULL);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 }; 1540 };
1541 1541
1542 VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete) 1542 VIEW_TEST(BookmarkBarViewTest15, MenuStaysVisibleAfterDelete)
1543 1543
1544 // Tests that we don't crash or get stuck if the parent of a menu is closed. 1544 // Tests that we don't crash or get stuck if the parent of a menu is closed.
1545 class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase { 1545 class BookmarkBarViewTest16 : public BookmarkBarViewEventTestBase {
1546 protected: 1546 protected:
1547 virtual void DoTestOnMessageLoop() OVERRIDE { 1547 virtual void DoTestOnMessageLoop() OVERRIDE {
1548 // Move the mouse to the first folder on the bookmark bar and press the 1548 // Move the mouse to the first folder on the bookmark bar and press the
1549 // mouse. 1549 // mouse.
1550 views::TextButton* button = GetBookmarkButton(0); 1550 views::LabelButton* button = GetBookmarkButton(0);
1551 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1551 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1552 ui_controls::DOWN | ui_controls::UP, 1552 ui_controls::DOWN | ui_controls::UP,
1553 CreateEventTask(this, &BookmarkBarViewTest16::Step2)); 1553 CreateEventTask(this, &BookmarkBarViewTest16::Step2));
1554 } 1554 }
1555 1555
1556 private: 1556 private:
1557 void Step2() { 1557 void Step2() {
1558 // Menu should be showing. 1558 // Menu should be showing.
1559 views::MenuItemView* menu = bb_view_->GetMenu(); 1559 views::MenuItemView* menu = bb_view_->GetMenu();
1560 ASSERT_TRUE(menu != NULL); 1560 ASSERT_TRUE(menu != NULL);
1561 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1561 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1562 1562
1563 // Button should be depressed. 1563 // Button should be depressed.
1564 views::TextButton* button = GetBookmarkButton(0); 1564 views::LabelButton* button = GetBookmarkButton(0);
1565 ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED); 1565 ASSERT_TRUE(button->state() == views::CustomButton::STATE_PRESSED);
1566 1566
1567 // Close the window. 1567 // Close the window.
1568 window_->Close(); 1568 window_->Close();
1569 window_ = NULL; 1569 window_ = NULL;
1570 1570
1571 base::MessageLoop::current()->PostTask( 1571 base::MessageLoop::current()->PostTask(
1572 FROM_HERE, CreateEventTask(this, &BookmarkBarViewTest16::Done)); 1572 FROM_HERE, CreateEventTask(this, &BookmarkBarViewTest16::Done));
1573 } 1573 }
1574 }; 1574 };
(...skipping 12 matching lines...) Expand all
1587 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase { 1587 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase {
1588 public: 1588 public:
1589 BookmarkBarViewTest17() 1589 BookmarkBarViewTest17()
1590 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) { 1590 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) {
1591 } 1591 }
1592 1592
1593 protected: 1593 protected:
1594 virtual void DoTestOnMessageLoop() OVERRIDE { 1594 virtual void DoTestOnMessageLoop() OVERRIDE {
1595 // Move the mouse to the other folder on the bookmark bar and press the 1595 // Move the mouse to the other folder on the bookmark bar and press the
1596 // left mouse button. 1596 // left mouse button.
1597 views::TextButton* button = bb_view_->other_bookmarked_button(); 1597 views::LabelButton* button = bb_view_->other_bookmarked_button();
1598 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1598 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1599 ui_controls::DOWN | ui_controls::UP, 1599 ui_controls::DOWN | ui_controls::UP,
1600 CreateEventTask(this, &BookmarkBarViewTest17::Step2)); 1600 CreateEventTask(this, &BookmarkBarViewTest17::Step2));
1601 } 1601 }
1602 1602
1603 private: 1603 private:
1604 void Step2() { 1604 void Step2() {
1605 // Menu should be showing. 1605 // Menu should be showing.
1606 views::MenuItemView* menu = bb_view_->GetMenu(); 1606 views::MenuItemView* menu = bb_view_->GetMenu();
1607 ASSERT_TRUE(menu != NULL); 1607 ASSERT_TRUE(menu != NULL);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3) 1671 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3)
1672 1672
1673 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then 1673 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then
1674 // moves the mouse over the first item on the bookmark bar and makes sure the 1674 // moves the mouse over the first item on the bookmark bar and makes sure the
1675 // menu appears. 1675 // menu appears.
1676 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase { 1676 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase {
1677 protected: 1677 protected:
1678 virtual void DoTestOnMessageLoop() OVERRIDE { 1678 virtual void DoTestOnMessageLoop() OVERRIDE {
1679 // Move the mouse to the other folder on the bookmark bar and press the 1679 // Move the mouse to the other folder on the bookmark bar and press the
1680 // left mouse button. 1680 // left mouse button.
1681 views::TextButton* button = bb_view_->other_bookmarked_button(); 1681 views::LabelButton* button = bb_view_->other_bookmarked_button();
1682 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1682 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1683 ui_controls::DOWN | ui_controls::UP, 1683 ui_controls::DOWN | ui_controls::UP,
1684 CreateEventTask(this, &BookmarkBarViewTest18::Step2)); 1684 CreateEventTask(this, &BookmarkBarViewTest18::Step2));
1685 } 1685 }
1686 1686
1687 private: 1687 private:
1688 void Step2() { 1688 void Step2() {
1689 // Menu should be showing. 1689 // Menu should be showing.
1690 views::MenuItemView* menu = bb_view_->GetMenu(); 1690 views::MenuItemView* menu = bb_view_->GetMenu();
1691 ASSERT_TRUE(menu != NULL); 1691 ASSERT_TRUE(menu != NULL);
1692 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1692 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1693 1693
1694 // Move the mouse to the first folder on the bookmark bar 1694 // Move the mouse to the first folder on the bookmark bar
1695 views::TextButton* button = GetBookmarkButton(0); 1695 views::LabelButton* button = GetBookmarkButton(0);
1696 gfx::Point button_center(button->width() / 2, button->height() / 2); 1696 gfx::Point button_center(button->width() / 2, button->height() / 2);
1697 views::View::ConvertPointToScreen(button, &button_center); 1697 views::View::ConvertPointToScreen(button, &button_center);
1698 ui_controls::SendMouseMoveNotifyWhenDone( 1698 ui_controls::SendMouseMoveNotifyWhenDone(
1699 button_center.x(), button_center.y(), 1699 button_center.x(), button_center.y(),
1700 CreateEventTask(this, &BookmarkBarViewTest18::Step3)); 1700 CreateEventTask(this, &BookmarkBarViewTest18::Step3));
1701 } 1701 }
1702 1702
1703 void Step3() { 1703 void Step3() {
1704 // Make sure the menu is showing. 1704 // Make sure the menu is showing.
1705 views::MenuItemView* menu = bb_view_->GetMenu(); 1705 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 22 matching lines...) Expand all
1728 1728
1729 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu) 1729 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu)
1730 1730
1731 // Verifies mousing over an already open sibling menu doesn't prematurely cancel 1731 // Verifies mousing over an already open sibling menu doesn't prematurely cancel
1732 // the menu. 1732 // the menu.
1733 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase { 1733 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase {
1734 protected: 1734 protected:
1735 virtual void DoTestOnMessageLoop() OVERRIDE { 1735 virtual void DoTestOnMessageLoop() OVERRIDE {
1736 // Move the mouse to the other folder on the bookmark bar and press the 1736 // Move the mouse to the other folder on the bookmark bar and press the
1737 // left mouse button. 1737 // left mouse button.
1738 views::TextButton* button = bb_view_->other_bookmarked_button(); 1738 views::LabelButton* button = bb_view_->other_bookmarked_button();
1739 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1739 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1740 ui_controls::DOWN | ui_controls::UP, 1740 ui_controls::DOWN | ui_controls::UP,
1741 CreateEventTask(this, &BookmarkBarViewTest19::Step2)); 1741 CreateEventTask(this, &BookmarkBarViewTest19::Step2));
1742 } 1742 }
1743 1743
1744 private: 1744 private:
1745 void Step2() { 1745 void Step2() {
1746 // Menu should be showing. 1746 // Menu should be showing.
1747 views::MenuItemView* menu = bb_view_->GetMenu(); 1747 views::MenuItemView* menu = bb_view_->GetMenu();
1748 ASSERT_TRUE(menu != NULL); 1748 ASSERT_TRUE(menu != NULL);
1749 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1749 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1750 1750
1751 // Click on the first folder. 1751 // Click on the first folder.
1752 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); 1752 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1);
1753 ASSERT_TRUE(child_menu != NULL); 1753 ASSERT_TRUE(child_menu != NULL);
1754 ui_test_utils::MoveMouseToCenterAndPress( 1754 ui_test_utils::MoveMouseToCenterAndPress(
1755 child_menu, ui_controls::LEFT, 1755 child_menu, ui_controls::LEFT,
1756 ui_controls::DOWN | ui_controls::UP, 1756 ui_controls::DOWN | ui_controls::UP,
1757 CreateEventTask(this, &BookmarkBarViewTest19::Step3)); 1757 CreateEventTask(this, &BookmarkBarViewTest19::Step3));
1758 } 1758 }
1759 1759
1760 void Step3() { 1760 void Step3() {
1761 // Make sure the menu is showing. 1761 // Make sure the menu is showing.
1762 views::MenuItemView* menu = bb_view_->GetMenu(); 1762 views::MenuItemView* menu = bb_view_->GetMenu();
1763 ASSERT_TRUE(menu != NULL); 1763 ASSERT_TRUE(menu != NULL);
1764 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1764 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1765 1765
1766 // Move the mouse back to the other bookmark button. 1766 // Move the mouse back to the other bookmark button.
1767 views::TextButton* button = bb_view_->other_bookmarked_button(); 1767 views::LabelButton* button = bb_view_->other_bookmarked_button();
1768 gfx::Point button_center(button->width() / 2, button->height() / 2); 1768 gfx::Point button_center(button->width() / 2, button->height() / 2);
1769 views::View::ConvertPointToScreen(button, &button_center); 1769 views::View::ConvertPointToScreen(button, &button_center);
1770 ui_controls::SendMouseMoveNotifyWhenDone( 1770 ui_controls::SendMouseMoveNotifyWhenDone(
1771 button_center.x() + 1, button_center.y() + 1, 1771 button_center.x() + 1, button_center.y() + 1,
1772 CreateEventTask(this, &BookmarkBarViewTest19::Step4)); 1772 CreateEventTask(this, &BookmarkBarViewTest19::Step4));
1773 } 1773 }
1774 1774
1775 void Step4() { 1775 void Step4() {
1776 // Menu should be showing. 1776 // Menu should be showing.
1777 views::MenuItemView* menu = bb_view_->GetMenu(); 1777 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 CreateEventTask(this, &BookmarkBarViewTest20::Step1)); 1827 CreateEventTask(this, &BookmarkBarViewTest20::Step1));
1828 } 1828 }
1829 1829
1830 private: 1830 private:
1831 void Step1() { 1831 void Step1() {
1832 ASSERT_EQ(test_view_->press_count(), 1); 1832 ASSERT_EQ(test_view_->press_count(), 1);
1833 ASSERT_TRUE(bb_view_->GetMenu() == NULL); 1833 ASSERT_TRUE(bb_view_->GetMenu() == NULL);
1834 1834
1835 // Move the mouse to the first folder on the bookmark bar and press the 1835 // Move the mouse to the first folder on the bookmark bar and press the
1836 // left mouse button. 1836 // left mouse button.
1837 views::TextButton* button = GetBookmarkButton(0); 1837 views::LabelButton* button = GetBookmarkButton(0);
1838 ui_test_utils::MoveMouseToCenterAndPress( 1838 ui_test_utils::MoveMouseToCenterAndPress(
1839 button, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, 1839 button, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
1840 CreateEventTask(this, &BookmarkBarViewTest20::Step2)); 1840 CreateEventTask(this, &BookmarkBarViewTest20::Step2));
1841 } 1841 }
1842 1842
1843 void Step2() { 1843 void Step2() {
1844 ASSERT_EQ(test_view_->press_count(), 1); 1844 ASSERT_EQ(test_view_->press_count(), 1);
1845 views::MenuItemView* menu = bb_view_->GetMenu(); 1845 views::MenuItemView* menu = bb_view_->GetMenu();
1846 ASSERT_TRUE(menu != NULL); 1846 ASSERT_TRUE(menu != NULL);
1847 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1847 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase { 1914 class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase {
1915 public: 1915 public:
1916 BookmarkBarViewTest21() 1916 BookmarkBarViewTest21()
1917 : observer_(CreateEventTask(this, &BookmarkBarViewTest21::Step3)) { 1917 : observer_(CreateEventTask(this, &BookmarkBarViewTest21::Step3)) {
1918 } 1918 }
1919 1919
1920 protected: 1920 protected:
1921 // Move the mouse to the empty folder on the bookmark bar and press the 1921 // Move the mouse to the empty folder on the bookmark bar and press the
1922 // left mouse button. 1922 // left mouse button.
1923 virtual void DoTestOnMessageLoop() OVERRIDE { 1923 virtual void DoTestOnMessageLoop() OVERRIDE {
1924 views::TextButton* button = GetBookmarkButton(5); 1924 views::LabelButton* button = GetBookmarkButton(5);
1925 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1925 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1926 ui_controls::DOWN | ui_controls::UP, 1926 ui_controls::DOWN | ui_controls::UP,
1927 CreateEventTask(this, &BookmarkBarViewTest21::Step2)); 1927 CreateEventTask(this, &BookmarkBarViewTest21::Step2));
1928 } 1928 }
1929 1929
1930 private: 1930 private:
1931 // Confirm that a menu for empty folder shows and right click the menu. 1931 // Confirm that a menu for empty folder shows and right click the menu.
1932 void Step2() { 1932 void Step2() {
1933 // Menu should be showing. 1933 // Menu should be showing.
1934 views::MenuItemView* menu = bb_view_->GetMenu(); 1934 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 26 matching lines...) Expand all
1961 ASSERT_TRUE(delete_menu); 1961 ASSERT_TRUE(delete_menu);
1962 1962
1963 // Click on the delete menu item. 1963 // Click on the delete menu item.
1964 ui_test_utils::MoveMouseToCenterAndPress(delete_menu, 1964 ui_test_utils::MoveMouseToCenterAndPress(delete_menu,
1965 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, 1965 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
1966 CreateEventTask(this, &BookmarkBarViewTest21::Step4)); 1966 CreateEventTask(this, &BookmarkBarViewTest21::Step4));
1967 } 1967 }
1968 1968
1969 // Confirm that the empty folder gets removed and menu doesn't show. 1969 // Confirm that the empty folder gets removed and menu doesn't show.
1970 void Step4() { 1970 void Step4() {
1971 views::TextButton* button = GetBookmarkButton(5); 1971 views::LabelButton* button = GetBookmarkButton(5);
1972 ASSERT_TRUE(button); 1972 ASSERT_TRUE(button);
1973 EXPECT_EQ(ASCIIToUTF16("d"), button->text()); 1973 EXPECT_EQ(ASCIIToUTF16("d"), button->GetText());
1974 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); 1974 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL);
1975 EXPECT_TRUE(bb_view_->GetMenu() == NULL); 1975 EXPECT_TRUE(bb_view_->GetMenu() == NULL);
1976 1976
1977 Done(); 1977 Done();
1978 } 1978 }
1979 1979
1980 BookmarkContextMenuNotificationObserver observer_; 1980 BookmarkContextMenuNotificationObserver observer_;
1981 }; 1981 };
1982 1982
1983 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) 1983 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698