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

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

Issue 723223005: bookmarks: Cleanup - Rename 'OtherBookmarked' to 'OtherBookmarks'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 6 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
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 VIEW_TEST(BookmarkBarViewTest2, MAYBE_HideOnDesktopClick) 495 VIEW_TEST(BookmarkBarViewTest2, MAYBE_HideOnDesktopClick)
496 496
497 // Brings up menu. Moves over child to make sure submenu appears, moves over 497 // Brings up menu. Moves over child to make sure submenu appears, moves over
498 // another child and make sure next menu appears. 498 // another child and make sure next menu appears.
499 class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase { 499 class BookmarkBarViewTest3 : public BookmarkBarViewEventTestBase {
500 protected: 500 protected:
501 void DoTestOnMessageLoop() override { 501 void DoTestOnMessageLoop() override {
502 // Move the mouse to the first folder on the bookmark bar and press the 502 // Move the mouse to the first folder on the bookmark bar and press the
503 // mouse. 503 // mouse.
504 views::MenuButton* button = bb_view_->other_bookmarked_button(); 504 views::MenuButton* button = bb_view_->other_bookmarks_button();
505 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 505 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
506 ui_controls::DOWN | ui_controls::UP, 506 ui_controls::DOWN | ui_controls::UP,
507 CreateEventTask(this, &BookmarkBarViewTest3::Step2)); 507 CreateEventTask(this, &BookmarkBarViewTest3::Step2));
508 } 508 }
509 509
510 private: 510 private:
511 void Step2() { 511 void Step2() {
512 // Menu should be showing. 512 // Menu should be showing.
513 views::MenuItemView* menu = bb_view_->GetMenu(); 513 views::MenuItemView* menu = bb_view_->GetMenu();
514 ASSERT_TRUE(menu != NULL); 514 ASSERT_TRUE(menu != NULL);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase { 601 class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase {
602 public: 602 public:
603 BookmarkBarViewTest4() 603 BookmarkBarViewTest4()
604 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) { 604 : observer_(CreateEventTask(this, &BookmarkBarViewTest4::Step3)) {
605 } 605 }
606 606
607 protected: 607 protected:
608 void DoTestOnMessageLoop() override { 608 void DoTestOnMessageLoop() override {
609 // Move the mouse to the first folder on the bookmark bar and press the 609 // Move the mouse to the first folder on the bookmark bar and press the
610 // mouse. 610 // mouse.
611 views::LabelButton* button = bb_view_->other_bookmarked_button(); 611 views::LabelButton* button = bb_view_->other_bookmarks_button();
612 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 612 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
613 ui_controls::DOWN | ui_controls::UP, 613 ui_controls::DOWN | ui_controls::UP,
614 CreateEventTask(this, &BookmarkBarViewTest4::Step2)); 614 CreateEventTask(this, &BookmarkBarViewTest4::Step2));
615 } 615 }
616 616
617 private: 617 private:
618 void Step2() { 618 void Step2() {
619 // Menu should be showing. 619 // Menu should be showing.
620 views::MenuItemView* menu = bb_view_->GetMenu(); 620 views::MenuItemView* menu = bb_view_->GetMenu();
621 ASSERT_TRUE(menu != NULL); 621 ASSERT_TRUE(menu != NULL);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 ASSERT_TRUE(child_menu != NULL); 792 ASSERT_TRUE(child_menu != NULL);
793 793
794 // Move mouse to center of menu and press button. 794 // Move mouse to center of menu and press button.
795 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT, 795 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT,
796 ui_controls::DOWN, 796 ui_controls::DOWN,
797 CreateEventTask(this, &BookmarkBarViewTest7::Step3)); 797 CreateEventTask(this, &BookmarkBarViewTest7::Step3));
798 } 798 }
799 799
800 void Step3() { 800 void Step3() {
801 // Drag over other button. 801 // Drag over other button.
802 views::LabelButton* other_button = 802 views::LabelButton* other_button = bb_view_->other_bookmarks_button();
803 bb_view_->other_bookmarked_button();
804 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 803 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
805 views::View::ConvertPointToScreen(other_button, &loc); 804 views::View::ConvertPointToScreen(other_button, &loc);
806 805
807 #if defined(USE_AURA) 806 #if defined(USE_AURA)
808 // TODO: fix this. Aura requires an additional mouse event to trigger drag 807 // TODO: fix this. Aura requires an additional mouse event to trigger drag
809 // and drop checking state. 808 // and drop checking state.
810 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 809 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
811 base::Bind(&BookmarkBarViewTest7::Step3A, this)); 810 base::Bind(&BookmarkBarViewTest7::Step3A, this));
812 #else 811 #else
813 // Start a drag. 812 // Start a drag.
814 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 813 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
815 base::Bind(&BookmarkBarViewTest7::Step4, this)); 814 base::Bind(&BookmarkBarViewTest7::Step4, this));
816 815
817 // See comment above this method as to why we do this. 816 // See comment above this method as to why we do this.
818 ScheduleMouseMoveInBackground(loc.x(), loc.y()); 817 ScheduleMouseMoveInBackground(loc.x(), loc.y());
819 #endif 818 #endif
820 } 819 }
821 820
822 void Step3A() { 821 void Step3A() {
823 // Drag over other button. 822 // Drag over other button.
824 views::LabelButton* other_button = 823 views::LabelButton* other_button = bb_view_->other_bookmarks_button();
825 bb_view_->other_bookmarked_button();
826 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 824 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
827 views::View::ConvertPointToScreen(other_button, &loc); 825 views::View::ConvertPointToScreen(other_button, &loc);
828 826
829 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(), 827 ui_controls::SendMouseMoveNotifyWhenDone(loc.x(), loc.y(),
830 base::Bind(&BookmarkBarViewTest7::Step4, this)); 828 base::Bind(&BookmarkBarViewTest7::Step4, this));
831 } 829 }
832 830
833 void Step4() { 831 void Step4() {
834 views::MenuItemView* drop_menu = bb_view_->GetDropMenu(); 832 views::MenuItemView* drop_menu = bb_view_->GetDropMenu();
835 ASSERT_TRUE(drop_menu != NULL); 833 ASSERT_TRUE(drop_menu != NULL);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 ASSERT_TRUE(child_menu != NULL); 890 ASSERT_TRUE(child_menu != NULL);
893 891
894 // Move mouse to center of menu and press button. 892 // Move mouse to center of menu and press button.
895 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT, 893 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT,
896 ui_controls::DOWN, 894 ui_controls::DOWN,
897 CreateEventTask(this, &BookmarkBarViewTest8::Step3)); 895 CreateEventTask(this, &BookmarkBarViewTest8::Step3));
898 } 896 }
899 897
900 void Step3() { 898 void Step3() {
901 // Drag over other button. 899 // Drag over other button.
902 views::LabelButton* other_button = 900 views::LabelButton* other_button = bb_view_->other_bookmarks_button();
903 bb_view_->other_bookmarked_button();
904 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 901 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
905 views::View::ConvertPointToScreen(other_button, &loc); 902 views::View::ConvertPointToScreen(other_button, &loc);
906 903
907 // Start a drag. 904 // Start a drag.
908 #if defined(USE_AURA) 905 #if defined(USE_AURA)
909 // TODO: fix this. Aura requires an additional mouse event to trigger drag 906 // TODO: fix this. Aura requires an additional mouse event to trigger drag
910 // and drop checking state. 907 // and drop checking state.
911 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 908 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
912 base::Bind(&BookmarkBarViewTest8::Step3A, this)); 909 base::Bind(&BookmarkBarViewTest8::Step3A, this));
913 #else 910 #else
914 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 911 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
915 base::Bind(&BookmarkBarViewTest8::Step4, this)); 912 base::Bind(&BookmarkBarViewTest8::Step4, this));
916 // See comment above this method as to why we do this. 913 // See comment above this method as to why we do this.
917 ScheduleMouseMoveInBackground(loc.x(), loc.y()); 914 ScheduleMouseMoveInBackground(loc.x(), loc.y());
918 #endif 915 #endif
919 } 916 }
920 917
921 void Step3A() { 918 void Step3A() {
922 // Drag over other button. 919 // Drag over other button.
923 views::LabelButton* other_button = 920 views::LabelButton* other_button = bb_view_->other_bookmarks_button();
924 bb_view_->other_bookmarked_button();
925 gfx::Point loc(other_button->width() / 2, other_button->height() / 2); 921 gfx::Point loc(other_button->width() / 2, other_button->height() / 2);
926 views::View::ConvertPointToScreen(other_button, &loc); 922 views::View::ConvertPointToScreen(other_button, &loc);
927 923
928 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), 924 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(),
929 base::Bind(&BookmarkBarViewTest8::Step4, this)); 925 base::Bind(&BookmarkBarViewTest8::Step4, this));
930 } 926 }
931 927
932 void Step4() { 928 void Step4() {
933 views::MenuItemView* drop_menu = bb_view_->GetDropMenu(); 929 views::MenuItemView* drop_menu = bb_view_->GetDropMenu();
934 ASSERT_TRUE(drop_menu != NULL); 930 ASSERT_TRUE(drop_menu != NULL);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { 1167 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase {
1172 public: 1168 public:
1173 BookmarkBarViewTest11() 1169 BookmarkBarViewTest11()
1174 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) { 1170 : observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3)) {
1175 } 1171 }
1176 1172
1177 protected: 1173 protected:
1178 void DoTestOnMessageLoop() override { 1174 void DoTestOnMessageLoop() override {
1179 // 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
1180 // mouse. 1176 // mouse.
1181 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1177 views::LabelButton* button = bb_view_->other_bookmarks_button();
1182 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1178 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1183 ui_controls::DOWN | ui_controls::UP, 1179 ui_controls::DOWN | ui_controls::UP,
1184 CreateEventTask(this, &BookmarkBarViewTest11::Step2)); 1180 CreateEventTask(this, &BookmarkBarViewTest11::Step2));
1185 } 1181 }
1186 1182
1187 private: 1183 private:
1188 void Step2() { 1184 void Step2() {
1189 // Menu should be showing. 1185 // Menu should be showing.
1190 views::MenuItemView* menu = bb_view_->GetMenu(); 1186 views::MenuItemView* menu = bb_view_->GetMenu();
1191 ASSERT_TRUE(menu != NULL); 1187 ASSERT_TRUE(menu != NULL);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu 1246 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu
1251 #endif 1247 #endif
1252 1248
1253 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu) 1249 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu)
1254 1250
1255 // Tests showing a modal dialog from a context menu. 1251 // Tests showing a modal dialog from a context menu.
1256 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { 1252 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase {
1257 protected: 1253 protected:
1258 void DoTestOnMessageLoop() override { 1254 void DoTestOnMessageLoop() override {
1259 // Open up the other folder. 1255 // Open up the other folder.
1260 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1256 views::LabelButton* button = bb_view_->other_bookmarks_button();
1261 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1257 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1262 ui_controls::DOWN | ui_controls::UP, 1258 ui_controls::DOWN | ui_controls::UP,
1263 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); 1259 CreateEventTask(this, &BookmarkBarViewTest12::Step2));
1264 chrome::num_bookmark_urls_before_prompting = 1; 1260 chrome::num_bookmark_urls_before_prompting = 1;
1265 } 1261 }
1266 1262
1267 ~BookmarkBarViewTest12() override { 1263 ~BookmarkBarViewTest12() override {
1268 chrome::num_bookmark_urls_before_prompting = 15; 1264 chrome::num_bookmark_urls_before_prompting = 15;
1269 } 1265 }
1270 1266
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { 1349 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase {
1354 public: 1350 public:
1355 BookmarkBarViewTest13() 1351 BookmarkBarViewTest13()
1356 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) { 1352 : observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3)) {
1357 } 1353 }
1358 1354
1359 protected: 1355 protected:
1360 void DoTestOnMessageLoop() override { 1356 void DoTestOnMessageLoop() override {
1361 // Move the mouse to the first folder on the bookmark bar and press the 1357 // Move the mouse to the first folder on the bookmark bar and press the
1362 // mouse. 1358 // mouse.
1363 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1359 views::LabelButton* button = bb_view_->other_bookmarks_button();
1364 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1360 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1365 ui_controls::DOWN | ui_controls::UP, 1361 ui_controls::DOWN | ui_controls::UP,
1366 CreateEventTask(this, &BookmarkBarViewTest13::Step2)); 1362 CreateEventTask(this, &BookmarkBarViewTest13::Step2));
1367 } 1363 }
1368 1364
1369 private: 1365 private:
1370 void Step2() { 1366 void Step2() {
1371 // Menu should be showing. 1367 // Menu should be showing.
1372 views::MenuItemView* menu = bb_view_->GetMenu(); 1368 views::MenuItemView* menu = bb_view_->GetMenu();
1373 ASSERT_TRUE(menu != NULL); 1369 ASSERT_TRUE(menu != NULL);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { 1479 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase {
1484 public: 1480 public:
1485 BookmarkBarViewTest15() 1481 BookmarkBarViewTest15()
1486 : deleted_menu_id_(0), 1482 : deleted_menu_id_(0),
1487 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) { 1483 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3)) {
1488 } 1484 }
1489 1485
1490 protected: 1486 protected:
1491 void DoTestOnMessageLoop() override { 1487 void DoTestOnMessageLoop() override {
1492 // Show the other bookmarks. 1488 // Show the other bookmarks.
1493 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1489 views::LabelButton* button = bb_view_->other_bookmarks_button();
1494 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1490 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1495 ui_controls::DOWN | ui_controls::UP, 1491 ui_controls::DOWN | ui_controls::UP,
1496 CreateEventTask(this, &BookmarkBarViewTest15::Step2)); 1492 CreateEventTask(this, &BookmarkBarViewTest15::Step2));
1497 } 1493 }
1498 1494
1499 private: 1495 private:
1500 void Step2() { 1496 void Step2() {
1501 // Menu should be showing. 1497 // Menu should be showing.
1502 views::MenuItemView* menu = bb_view_->GetMenu(); 1498 views::MenuItemView* menu = bb_view_->GetMenu();
1503 ASSERT_TRUE(menu != NULL); 1499 ASSERT_TRUE(menu != NULL);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase { 1598 class BookmarkBarViewTest17 : public BookmarkBarViewEventTestBase {
1603 public: 1599 public:
1604 BookmarkBarViewTest17() 1600 BookmarkBarViewTest17()
1605 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) { 1601 : observer_(CreateEventTask(this, &BookmarkBarViewTest17::Step3)) {
1606 } 1602 }
1607 1603
1608 protected: 1604 protected:
1609 void DoTestOnMessageLoop() override { 1605 void DoTestOnMessageLoop() override {
1610 // Move the mouse to the other folder on the bookmark bar and press the 1606 // Move the mouse to the other folder on the bookmark bar and press the
1611 // left mouse button. 1607 // left mouse button.
1612 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1608 views::LabelButton* button = bb_view_->other_bookmarks_button();
1613 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1609 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1614 ui_controls::DOWN | ui_controls::UP, 1610 ui_controls::DOWN | ui_controls::UP,
1615 CreateEventTask(this, &BookmarkBarViewTest17::Step2)); 1611 CreateEventTask(this, &BookmarkBarViewTest17::Step2));
1616 } 1612 }
1617 1613
1618 private: 1614 private:
1619 void Step2() { 1615 void Step2() {
1620 // Menu should be showing. 1616 // Menu should be showing.
1621 views::MenuItemView* menu = bb_view_->GetMenu(); 1617 views::MenuItemView* menu = bb_view_->GetMenu();
1622 ASSERT_TRUE(menu != NULL); 1618 ASSERT_TRUE(menu != NULL);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3) 1687 VIEW_TEST(BookmarkBarViewTest17, MAYBE_ContextMenus3)
1692 1688
1693 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then 1689 // Verifies sibling menus works. Clicks on the 'other bookmarks' folder, then
1694 // moves the mouse over the first item on the bookmark bar and makes sure the 1690 // moves the mouse over the first item on the bookmark bar and makes sure the
1695 // menu appears. 1691 // menu appears.
1696 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase { 1692 class BookmarkBarViewTest18 : public BookmarkBarViewEventTestBase {
1697 protected: 1693 protected:
1698 void DoTestOnMessageLoop() override { 1694 void DoTestOnMessageLoop() override {
1699 // Move the mouse to the other folder on the bookmark bar and press the 1695 // Move the mouse to the other folder on the bookmark bar and press the
1700 // left mouse button. 1696 // left mouse button.
1701 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1697 views::LabelButton* button = bb_view_->other_bookmarks_button();
1702 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1698 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1703 ui_controls::DOWN | ui_controls::UP, 1699 ui_controls::DOWN | ui_controls::UP,
1704 CreateEventTask(this, &BookmarkBarViewTest18::Step2)); 1700 CreateEventTask(this, &BookmarkBarViewTest18::Step2));
1705 } 1701 }
1706 1702
1707 private: 1703 private:
1708 void Step2() { 1704 void Step2() {
1709 // Menu should be showing. 1705 // Menu should be showing.
1710 views::MenuItemView* menu = bb_view_->GetMenu(); 1706 views::MenuItemView* menu = bb_view_->GetMenu();
1711 ASSERT_TRUE(menu != NULL); 1707 ASSERT_TRUE(menu != NULL);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 1744
1749 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu) 1745 VIEW_TEST(BookmarkBarViewTest18, MAYBE_BookmarkBarViewTest18_SiblingMenu)
1750 1746
1751 // Verifies mousing over an already open sibling menu doesn't prematurely cancel 1747 // Verifies mousing over an already open sibling menu doesn't prematurely cancel
1752 // the menu. 1748 // the menu.
1753 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase { 1749 class BookmarkBarViewTest19 : public BookmarkBarViewEventTestBase {
1754 protected: 1750 protected:
1755 void DoTestOnMessageLoop() override { 1751 void DoTestOnMessageLoop() override {
1756 // Move the mouse to the other folder on the bookmark bar and press the 1752 // Move the mouse to the other folder on the bookmark bar and press the
1757 // left mouse button. 1753 // left mouse button.
1758 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1754 views::LabelButton* button = bb_view_->other_bookmarks_button();
1759 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, 1755 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT,
1760 ui_controls::DOWN | ui_controls::UP, 1756 ui_controls::DOWN | ui_controls::UP,
1761 CreateEventTask(this, &BookmarkBarViewTest19::Step2)); 1757 CreateEventTask(this, &BookmarkBarViewTest19::Step2));
1762 } 1758 }
1763 1759
1764 private: 1760 private:
1765 void Step2() { 1761 void Step2() {
1766 // Menu should be showing. 1762 // Menu should be showing.
1767 views::MenuItemView* menu = bb_view_->GetMenu(); 1763 views::MenuItemView* menu = bb_view_->GetMenu();
1768 ASSERT_TRUE(menu != NULL); 1764 ASSERT_TRUE(menu != NULL);
1769 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1765 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1770 1766
1771 // Click on the first folder. 1767 // Click on the first folder.
1772 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); 1768 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1);
1773 ASSERT_TRUE(child_menu != NULL); 1769 ASSERT_TRUE(child_menu != NULL);
1774 ui_test_utils::MoveMouseToCenterAndPress( 1770 ui_test_utils::MoveMouseToCenterAndPress(
1775 child_menu, ui_controls::LEFT, 1771 child_menu, ui_controls::LEFT,
1776 ui_controls::DOWN | ui_controls::UP, 1772 ui_controls::DOWN | ui_controls::UP,
1777 CreateEventTask(this, &BookmarkBarViewTest19::Step3)); 1773 CreateEventTask(this, &BookmarkBarViewTest19::Step3));
1778 } 1774 }
1779 1775
1780 void Step3() { 1776 void Step3() {
1781 // Make sure the menu is showing. 1777 // Make sure the menu is showing.
1782 views::MenuItemView* menu = bb_view_->GetMenu(); 1778 views::MenuItemView* menu = bb_view_->GetMenu();
1783 ASSERT_TRUE(menu != NULL); 1779 ASSERT_TRUE(menu != NULL);
1784 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1780 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1785 1781
1786 // Move the mouse back to the other bookmark button. 1782 // Move the mouse back to the "Other Bookmarks" button.
1787 views::LabelButton* button = bb_view_->other_bookmarked_button(); 1783 views::LabelButton* button = bb_view_->other_bookmarks_button();
1788 gfx::Point button_center(button->width() / 2, button->height() / 2); 1784 gfx::Point button_center(button->width() / 2, button->height() / 2);
1789 views::View::ConvertPointToScreen(button, &button_center); 1785 views::View::ConvertPointToScreen(button, &button_center);
1790 ui_controls::SendMouseMoveNotifyWhenDone( 1786 ui_controls::SendMouseMoveNotifyWhenDone(
1791 button_center.x() + 1, button_center.y() + 1, 1787 button_center.x() + 1, button_center.y() + 1,
1792 CreateEventTask(this, &BookmarkBarViewTest19::Step4)); 1788 CreateEventTask(this, &BookmarkBarViewTest19::Step4));
1793 } 1789 }
1794 1790
1795 void Step4() { 1791 void Step4() {
1796 // Menu should be showing. 1792 // Menu should be showing.
1797 views::MenuItemView* menu = bb_view_->GetMenu(); 1793 views::MenuItemView* menu = bb_view_->GetMenu();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); 1990 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL);
1995 EXPECT_TRUE(bb_view_->GetMenu() == NULL); 1991 EXPECT_TRUE(bb_view_->GetMenu() == NULL);
1996 1992
1997 Done(); 1993 Done();
1998 } 1994 }
1999 1995
2000 BookmarkContextMenuNotificationObserver observer_; 1996 BookmarkContextMenuNotificationObserver observer_;
2001 }; 1997 };
2002 1998
2003 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) 1999 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder)
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698