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/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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 public: | 199 public: |
200 WebContents* OpenURL(const OpenURLParams& params) override { | 200 WebContents* OpenURL(const OpenURLParams& params) override { |
201 url_ = params.url; | 201 url_ = params.url; |
202 return NULL; | 202 return NULL; |
203 } | 203 } |
204 | 204 |
205 GURL url_; | 205 GURL url_; |
206 }; | 206 }; |
207 | 207 |
208 // TODO(erg): Fix bookmark DND tests on linux_aura. crbug.com/163931 | 208 // TODO(erg): Fix bookmark DND tests on linux_aura. crbug.com/163931 |
209 #if defined(OS_LINUX) && defined(USE_AURA) | 209 #if defined(OS_LINUX) |
210 #define MAYBE(x) DISABLED_##x | 210 #define MAYBE(x) DISABLED_##x |
211 #else | 211 #else |
212 #define MAYBE(x) x | 212 #define MAYBE(x) x |
213 #endif | 213 #endif |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 | 216 |
217 // Base class for event generating bookmark view tests. These test are intended | 217 // Base class for event generating bookmark view tests. These test are intended |
218 // to exercise View's menus, but that's easier done with BookmarkBarView rather | 218 // to exercise View's menus, but that's easier done with BookmarkBarView rather |
219 // than View's menu itself. | 219 // than View's menu itself. |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing()); | 478 ASSERT_TRUE(menu == NULL || !menu->GetSubmenu()->IsShowing()); |
479 | 479 |
480 // Make sure button is no longer pushed. | 480 // Make sure button is no longer pushed. |
481 views::LabelButton* button = GetBookmarkButton(0); | 481 views::LabelButton* button = GetBookmarkButton(0); |
482 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL); | 482 ASSERT_TRUE(button->state() == views::CustomButton::STATE_NORMAL); |
483 | 483 |
484 Done(); | 484 Done(); |
485 } | 485 } |
486 }; | 486 }; |
487 | 487 |
488 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 488 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
489 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 489 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
490 #define MAYBE_HideOnDesktopClick DISABLED_HideOnDesktopClick | 490 #define MAYBE_HideOnDesktopClick DISABLED_HideOnDesktopClick |
491 #else | 491 #else |
492 #define MAYBE_HideOnDesktopClick HideOnDesktopClick | 492 #define MAYBE_HideOnDesktopClick HideOnDesktopClick |
493 #endif | 493 #endif |
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. |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 // Make sure the menu is not showing. | 1227 // Make sure the menu is not showing. |
1228 views::MenuItemView* menu = bb_view_->GetMenu(); | 1228 views::MenuItemView* menu = bb_view_->GetMenu(); |
1229 ASSERT_TRUE(!menu || !menu->GetSubmenu() || | 1229 ASSERT_TRUE(!menu || !menu->GetSubmenu() || |
1230 !menu->GetSubmenu()->IsShowing()); | 1230 !menu->GetSubmenu()->IsShowing()); |
1231 Done(); | 1231 Done(); |
1232 } | 1232 } |
1233 | 1233 |
1234 BookmarkContextMenuNotificationObserver observer_; | 1234 BookmarkContextMenuNotificationObserver observer_; |
1235 }; | 1235 }; |
1236 | 1236 |
1237 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 1237 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1238 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 1238 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
1239 #define MAYBE_CloseMenuAfterClosingContextMenu \ | 1239 #define MAYBE_CloseMenuAfterClosingContextMenu \ |
1240 DISABLED_CloseMenuAfterClosingContextMenu | 1240 DISABLED_CloseMenuAfterClosingContextMenu |
1241 #elif defined(USE_OZONE) | 1241 #elif defined(USE_OZONE) |
1242 // ozone bringup - http://crbug.com/401304 | 1242 // ozone bringup - http://crbug.com/401304 |
1243 #define MAYBE_CloseMenuAfterClosingContextMenu \ | 1243 #define MAYBE_CloseMenuAfterClosingContextMenu \ |
1244 DISABLED_CloseMenuAfterClosingContextMenu | 1244 DISABLED_CloseMenuAfterClosingContextMenu |
1245 #else | 1245 #else |
1246 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu | 1246 #define MAYBE_CloseMenuAfterClosingContextMenu CloseMenuAfterClosingContextMenu |
1247 #endif | 1247 #endif |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1328 false, | 1328 false, |
1329 false, | 1329 false, |
1330 false, | 1330 false, |
1331 false, | 1331 false, |
1332 base::Closure()); | 1332 base::Closure()); |
1333 waiter.WaitForDialogClose(); | 1333 waiter.WaitForDialogClose(); |
1334 Done(); | 1334 Done(); |
1335 } | 1335 } |
1336 }; | 1336 }; |
1337 | 1337 |
1338 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 1338 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1339 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 1339 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
1340 #define MAYBE_CloseWithModalDialog DISABLED_CloseWithModalDialog | 1340 #define MAYBE_CloseWithModalDialog DISABLED_CloseWithModalDialog |
1341 #else | 1341 #else |
1342 #define MAYBE_CloseWithModalDialog CloseWithModalDialog | 1342 #define MAYBE_CloseWithModalDialog CloseWithModalDialog |
1343 #endif | 1343 #endif |
1344 | 1344 |
1345 VIEW_TEST(BookmarkBarViewTest12, MAYBE_CloseWithModalDialog) | 1345 VIEW_TEST(BookmarkBarViewTest12, MAYBE_CloseWithModalDialog) |
1346 | 1346 |
1347 // Tests clicking on the separator of a context menu (this is for coverage of | 1347 // Tests clicking on the separator of a context menu (this is for coverage of |
1348 // bug 17862). | 1348 // bug 17862). |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1665 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1665 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1666 | 1666 |
1667 bb_view_->GetMenu()->GetMenuController()->CancelAll(); | 1667 bb_view_->GetMenu()->GetMenuController()->CancelAll(); |
1668 | 1668 |
1669 Done(); | 1669 Done(); |
1670 } | 1670 } |
1671 | 1671 |
1672 BookmarkContextMenuNotificationObserver observer_; | 1672 BookmarkContextMenuNotificationObserver observer_; |
1673 }; | 1673 }; |
1674 | 1674 |
1675 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) | 1675 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1676 // TODO(erg): linux_aura bringup: http://crbug.com/163931 | 1676 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
1677 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 | 1677 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 |
1678 #elif defined(USE_OZONE) | 1678 #elif defined(USE_OZONE) |
1679 // ozone bringup - http://crbug.com/401304 | 1679 // ozone bringup - http://crbug.com/401304 |
1680 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 | 1680 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 |
1681 #elif defined(OS_WIN) // http://crbug.com/128961 | 1681 #elif defined(OS_WIN) // http://crbug.com/128961 |
1682 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 | 1682 #define MAYBE_ContextMenus3 DISABLED_ContextMenus3 |
1683 #else | 1683 #else |
1684 #define MAYBE_ContextMenus3 ContextMenus3 | 1684 #define MAYBE_ContextMenus3 ContextMenus3 |
1685 #endif | 1685 #endif |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1990 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); | 1990 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); |
1991 EXPECT_TRUE(bb_view_->GetMenu() == NULL); | 1991 EXPECT_TRUE(bb_view_->GetMenu() == NULL); |
1992 | 1992 |
1993 Done(); | 1993 Done(); |
1994 } | 1994 } |
1995 | 1995 |
1996 BookmarkContextMenuNotificationObserver observer_; | 1996 BookmarkContextMenuNotificationObserver observer_; |
1997 }; | 1997 }; |
1998 | 1998 |
1999 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) | 1999 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) |
2000 | |
2001 // Test that closing the source browser window while dragging a bookmark does | |
2002 // not cause a crash. | |
2003 class BookmarkBarViewTest22 : public BookmarkBarViewEventTestBase { | |
2004 protected: | |
2005 void DoTestOnMessageLoop() override { | |
2006 // Move the mouse to the first folder on the bookmark bar and press the | |
2007 // mouse. | |
2008 views::LabelButton* button = GetBookmarkButton(0); | |
2009 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | |
Peter Kasting
2014/12/22 21:31:09
Nit: All lines of args should align their start po
| |
2010 ui_controls::DOWN | ui_controls::UP, | |
2011 CreateEventTask(this, &BookmarkBarViewTest22::Step2)); | |
2012 } | |
2013 | |
2014 private: | |
2015 void Step2() { | |
2016 // Menu should be showing. | |
2017 views::MenuItemView* menu = bb_view_->GetMenu(); | |
2018 ASSERT_TRUE(menu != NULL); | |
Peter Kasting
2014/12/22 21:31:09
Nit: "!= NULL" unnecessary, and we're trying to el
| |
2019 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | |
2020 | |
2021 views::MenuItemView* child_menu = | |
2022 menu->GetSubmenu()->GetMenuItemAt(0); | |
2023 ASSERT_TRUE(child_menu != NULL); | |
2024 | |
2025 // Move mouse to center of menu and press button. | |
2026 ui_test_utils::MoveMouseToCenterAndPress(child_menu, ui_controls::LEFT, | |
2027 ui_controls::DOWN, | |
2028 CreateEventTask(this, &BookmarkBarViewTest22::Step3)); | |
2029 } | |
2030 | |
2031 void Step3() { | |
2032 views::MenuItemView* target_menu = | |
2033 bb_view_->GetMenu()->GetSubmenu()->GetMenuItemAt(1); | |
2034 gfx::Point loc(1, target_menu->height() - 1); | |
2035 views::View::ConvertPointToScreen(target_menu, &loc); | |
2036 | |
2037 // Start a drag. | |
2038 ui_controls::SendMouseMoveNotifyWhenDone(loc.x() + 10, loc.y(), | |
2039 CreateEventTask(this, &BookmarkBarViewTest22::Step4)); | |
2040 | |
2041 // See comment above this method as to why we do this. | |
Peter Kasting
2014/12/22 21:31:09
What comment?
| |
2042 ScheduleMouseMoveInBackground(loc.x(), loc.y()); | |
2043 } | |
2044 | |
2045 void Step4() { | |
2046 window_->Close(); | |
2047 window_ = NULL; | |
2048 | |
2049 #if defined(OS_CHROMEOS) | |
2050 ui_controls::SendMouseEventsNotifyWhenDone( | |
2051 ui_controls::LEFT, ui_controls::UP, | |
2052 CreateEventTask(this, &BookmarkBarViewTest22::Done)); | |
2053 #else | |
2054 // There are no widgets to send the mouse release to. | |
2055 Done(); | |
2056 #endif | |
2057 } | |
2058 }; | |
2059 | |
2060 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
2061 // TODO(pkotwicz): Enable on Desktop Linux once crbug.com/438365 is fixed. | |
2062 #define MAYBE_CloseSourceBrowserDuringDrag DISABLED_CloseSourceBrowserDuringDrag | |
2063 #elif defined(OS_WIN) | |
2064 // This test times out on Windows. TODO(pkotwicz): Find out why. | |
2065 #define MAYBE_CloseSourceBrowserDuringDrag DISABLED_CloseSourceBrowserDuringDrag | |
2066 #else | |
2067 #define MAYBE_CloseSourceBrowserDuringDrag CloseSourceBrowserDuringDrag | |
2068 #endif | |
2069 | |
2070 VIEW_TEST(BookmarkBarViewTest22, MAYBE_CloseSourceBrowserDuringDrag) | |
OLD | NEW |