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 "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/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // next execution loop. | 947 // next execution loop. |
948 MessageLoop::current()->PostTask( | 948 MessageLoop::current()->PostTask( |
949 FROM_HERE, | 949 FROM_HERE, |
950 base::Bind(&ViewEventTestBase::Done, this)); | 950 base::Bind(&ViewEventTestBase::Done, this)); |
951 } | 951 } |
952 | 952 |
953 int start_y_; | 953 int start_y_; |
954 views::MenuItemView* first_menu_; | 954 views::MenuItemView* first_menu_; |
955 }; | 955 }; |
956 | 956 |
957 VIEW_TEST(BookmarkBarViewTest9, ScrollButtonScrolls) | 957 #if defined(OS_WIN) |
| 958 #define MAYBE_ScrollButtonScrolls DISABLED_ScrollButtonScrolls |
| 959 #else |
| 960 #define MAYBE_ScrollButtonScrolls ScrollButtonScrolls |
| 961 #endif |
| 962 VIEW_TEST(BookmarkBarViewTest9, MAYBE_ScrollButtonScrolls) |
958 | 963 |
959 // Tests up/down/left/enter key messages. | 964 // Tests up/down/left/enter key messages. |
960 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { | 965 class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { |
961 protected: | 966 protected: |
962 virtual void DoTestOnMessageLoop() { | 967 virtual void DoTestOnMessageLoop() { |
963 // Move the mouse to the first folder on the bookmark bar and press the | 968 // Move the mouse to the first folder on the bookmark bar and press the |
964 // mouse. | 969 // mouse. |
965 views::TextButton* button = GetBookmarkButton(0); | 970 views::TextButton* button = GetBookmarkButton(0); |
966 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 971 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
967 ui_controls::DOWN | ui_controls::UP, | 972 ui_controls::DOWN | ui_controls::UP, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 } | 1058 } |
1054 | 1059 |
1055 void Step8() { | 1060 void Step8() { |
1056 ASSERT_TRUE( | 1061 ASSERT_TRUE( |
1057 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url() == | 1062 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url() == |
1058 navigator_.url_); | 1063 navigator_.url_); |
1059 Done(); | 1064 Done(); |
1060 } | 1065 } |
1061 }; | 1066 }; |
1062 | 1067 |
1063 VIEW_TEST(BookmarkBarViewTest10, KeyEvents) | 1068 #if defined(OS_WIN) |
| 1069 #define MAYBE_KeyEvents DISABLED_KeyEvents |
| 1070 #else |
| 1071 #define MAYBE_KeyEvents KeyEvents |
| 1072 #endif |
| 1073 VIEW_TEST(BookmarkBarViewTest10, MAYBE_KeyEvents) |
1064 | 1074 |
1065 // Make sure the menu closes with the following sequence: show menu, show | 1075 // Make sure the menu closes with the following sequence: show menu, show |
1066 // context menu, close context menu (via escape), then click else where. This | 1076 // context menu, close context menu (via escape), then click else where. This |
1067 // effectively verifies we maintain mouse capture after the context menu is | 1077 // effectively verifies we maintain mouse capture after the context menu is |
1068 // hidden. | 1078 // hidden. |
1069 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { | 1079 class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { |
1070 public: | 1080 public: |
1071 BookmarkBarViewTest11() | 1081 BookmarkBarViewTest11() |
1072 : ALLOW_THIS_IN_INITIALIZER_LIST( | 1082 : ALLOW_THIS_IN_INITIALIZER_LIST( |
1073 observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3))) { | 1083 observer_(CreateEventTask(this, &BookmarkBarViewTest11::Step3))) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 // Make sure the menu is not showing. | 1140 // Make sure the menu is not showing. |
1131 views::MenuItemView* menu = bb_view_->GetMenu(); | 1141 views::MenuItemView* menu = bb_view_->GetMenu(); |
1132 ASSERT_TRUE(!menu || !menu->GetSubmenu() || | 1142 ASSERT_TRUE(!menu || !menu->GetSubmenu() || |
1133 !menu->GetSubmenu()->IsShowing()); | 1143 !menu->GetSubmenu()->IsShowing()); |
1134 Done(); | 1144 Done(); |
1135 } | 1145 } |
1136 | 1146 |
1137 ContextMenuNotificationObserver observer_; | 1147 ContextMenuNotificationObserver observer_; |
1138 }; | 1148 }; |
1139 | 1149 |
1140 VIEW_TEST(BookmarkBarViewTest11, CloseMenuAfterClosingContextMenu) | 1150 #if defined(OS_WIN) |
| 1151 #define MAYBE_CloseMenuAfterClosingContextMenu DISABLED_CloseMenuAfterClosingCon
textMenu |
| 1152 #else |
| 1153 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu |
| 1154 #endif |
| 1155 VIEW_TEST(BookmarkBarViewTest11, MAYBE_CloseMenuAfterClosingContextMenu) |
1141 | 1156 |
1142 // Tests showing a modal dialog from a context menu. | 1157 // Tests showing a modal dialog from a context menu. |
1143 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { | 1158 class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { |
1144 protected: | 1159 protected: |
1145 virtual void DoTestOnMessageLoop() { | 1160 virtual void DoTestOnMessageLoop() { |
1146 // Open up the other folder. | 1161 // Open up the other folder. |
1147 views::TextButton* button = bb_view_->other_bookmarked_button(); | 1162 views::TextButton* button = bb_view_->other_bookmarked_button(); |
1148 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 1163 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
1149 ui_controls::DOWN | ui_controls::UP, | 1164 ui_controls::DOWN | ui_controls::UP, |
1150 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); | 1165 CreateEventTask(this, &BookmarkBarViewTest12::Step2)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 // Do a delayed task to give the dialog time to exit. | 1227 // Do a delayed task to give the dialog time to exit. |
1213 MessageLoop::current()->PostTask( | 1228 MessageLoop::current()->PostTask( |
1214 FROM_HERE, CreateEventTask(this, &BookmarkBarViewTest12::Step7)); | 1229 FROM_HERE, CreateEventTask(this, &BookmarkBarViewTest12::Step7)); |
1215 } | 1230 } |
1216 | 1231 |
1217 void Step7() { | 1232 void Step7() { |
1218 Done(); | 1233 Done(); |
1219 } | 1234 } |
1220 }; | 1235 }; |
1221 | 1236 |
1222 VIEW_TEST(BookmarkBarViewTest12, CloseWithModalDialog) | 1237 #if defined(OS_WIN) |
| 1238 #define MAYBE_CloseWithModalDialog DISABLED_CloseWithModalDialog |
| 1239 #else |
| 1240 #define MAYBE_CloseWithModalDialog CloseWithModalDialog |
| 1241 #endif |
| 1242 VIEW_TEST(BookmarkBarViewTest12, MAYBE_CloseWithModalDialog) |
1223 | 1243 |
1224 // Tests clicking on the separator of a context menu (this is for coverage of | 1244 // Tests clicking on the separator of a context menu (this is for coverage of |
1225 // bug 17862). | 1245 // bug 17862). |
1226 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { | 1246 class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase { |
1227 public: | 1247 public: |
1228 BookmarkBarViewTest13() | 1248 BookmarkBarViewTest13() |
1229 : ALLOW_THIS_IN_INITIALIZER_LIST( | 1249 : ALLOW_THIS_IN_INITIALIZER_LIST( |
1230 observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3))) { | 1250 observer_(CreateEventTask(this, &BookmarkBarViewTest13::Step3))) { |
1231 } | 1251 } |
1232 | 1252 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 CreateEventTask(this, &BookmarkBarViewTest13::Step5)); | 1317 CreateEventTask(this, &BookmarkBarViewTest13::Step5)); |
1298 } | 1318 } |
1299 | 1319 |
1300 void Step5() { | 1320 void Step5() { |
1301 Done(); | 1321 Done(); |
1302 } | 1322 } |
1303 | 1323 |
1304 ContextMenuNotificationObserver observer_; | 1324 ContextMenuNotificationObserver observer_; |
1305 }; | 1325 }; |
1306 | 1326 |
1307 VIEW_TEST(BookmarkBarViewTest13, ClickOnContextMenuSeparator) | 1327 #if defined(OS_WIN) |
| 1328 #define MAYBE_ClickOnContextMenuSeparator DISABLED_ClickOnContextMenuSeparator |
| 1329 #else |
| 1330 #define MAYBE_ClickOnContextMenuSeparator ClickOnContextMenuSeparator |
| 1331 #endif |
| 1332 VIEW_TEST(BookmarkBarViewTest13, MAYBE_ClickOnContextMenuSeparator) |
1308 | 1333 |
1309 // Makes sure right clicking on a folder on the bookmark bar doesn't result in | 1334 // Makes sure right clicking on a folder on the bookmark bar doesn't result in |
1310 // both a context menu and showing the menu. | 1335 // both a context menu and showing the menu. |
1311 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { | 1336 class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { |
1312 public: | 1337 public: |
1313 BookmarkBarViewTest14() | 1338 BookmarkBarViewTest14() |
1314 : ALLOW_THIS_IN_INITIALIZER_LIST( | 1339 : ALLOW_THIS_IN_INITIALIZER_LIST( |
1315 observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2))) { | 1340 observer_(CreateEventTask(this, &BookmarkBarViewTest14::Step2))) { |
1316 } | 1341 } |
1317 | 1342 |
(...skipping 20 matching lines...) Expand all Loading... |
1338 CreateEventTask(this, &BookmarkBarViewTest14::Step3)); | 1363 CreateEventTask(this, &BookmarkBarViewTest14::Step3)); |
1339 } | 1364 } |
1340 | 1365 |
1341 void Step3() { | 1366 void Step3() { |
1342 Done(); | 1367 Done(); |
1343 } | 1368 } |
1344 | 1369 |
1345 ContextMenuNotificationObserver observer_; | 1370 ContextMenuNotificationObserver observer_; |
1346 }; | 1371 }; |
1347 | 1372 |
1348 VIEW_TEST(BookmarkBarViewTest14, ContextMenus2) | 1373 #if defined(OS_WIN) |
| 1374 #define MAYBE_ContextMenus2 DISABLED_ContextMenus2 |
| 1375 #else |
| 1376 #define MAYBE_ContextMenus2 ContextMenus2 |
| 1377 #endif |
| 1378 VIEW_TEST(BookmarkBarViewTest14, MAYBE_ContextMenus2) |
1349 | 1379 |
1350 // Makes sure deleting from the context menu keeps the bookmark menu showing. | 1380 // Makes sure deleting from the context menu keeps the bookmark menu showing. |
1351 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { | 1381 class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase { |
1352 public: | 1382 public: |
1353 BookmarkBarViewTest15() | 1383 BookmarkBarViewTest15() |
1354 : deleted_menu_id_(0), | 1384 : deleted_menu_id_(0), |
1355 ALLOW_THIS_IN_INITIALIZER_LIST( | 1385 ALLOW_THIS_IN_INITIALIZER_LIST( |
1356 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3))) { | 1386 observer_(CreateEventTask(this, &BookmarkBarViewTest15::Step3))) { |
1357 } | 1387 } |
1358 | 1388 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 ASSERT_TRUE(menu != NULL); | 1682 ASSERT_TRUE(menu != NULL); |
1653 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1683 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1654 | 1684 |
1655 menu->GetMenuController()->CancelAll(); | 1685 menu->GetMenuController()->CancelAll(); |
1656 | 1686 |
1657 Done(); | 1687 Done(); |
1658 } | 1688 } |
1659 }; | 1689 }; |
1660 | 1690 |
1661 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) | 1691 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) |
OLD | NEW |