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

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

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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/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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 ASSERT_TRUE(menu != NULL); 1490 ASSERT_TRUE(menu != NULL);
1491 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); 1491 ASSERT_TRUE(menu->GetSubmenu()->IsShowing());
1492 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1); 1492 views::MenuItemView* child_menu = menu->GetSubmenu()->GetMenuItemAt(1);
1493 ASSERT_TRUE(child_menu != NULL); 1493 ASSERT_TRUE(child_menu != NULL);
1494 1494
1495 // The context menu and child_menu can be overlapped, calculate the 1495 // The context menu and child_menu can be overlapped, calculate the
1496 // non-intersected Rect of the child menu and click on its center to make 1496 // non-intersected Rect of the child menu and click on its center to make
1497 // sure the click is always on the child menu. 1497 // sure the click is always on the child menu.
1498 gfx::Rect context_rect = context_menu->GetSubmenu()->GetBoundsInScreen(); 1498 gfx::Rect context_rect = context_menu->GetSubmenu()->GetBoundsInScreen();
1499 gfx::Rect child_menu_rect = child_menu->GetBoundsInScreen(); 1499 gfx::Rect child_menu_rect = child_menu->GetBoundsInScreen();
1500 gfx::Rect clickable_rect = child_menu_rect; 1500 gfx::Rect clickable_rect = gfx::Subtraction(child_menu_rect, context_rect);
1501 clickable_rect.Subtract(context_rect);
1502 ASSERT_FALSE(clickable_rect.IsEmpty()); 1501 ASSERT_FALSE(clickable_rect.IsEmpty());
1503 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4)); 1502 observer_.set_task(CreateEventTask(this, &BookmarkBarViewTest17::Step4));
1504 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT, 1503 MoveMouseAndPress(clickable_rect.CenterPoint(), ui_controls::RIGHT,
1505 ui_controls::DOWN | ui_controls::UP, base::Closure()); 1504 ui_controls::DOWN | ui_controls::UP, base::Closure());
1506 // Step4 will be invoked by ContextMenuNotificationObserver. 1505 // Step4 will be invoked by ContextMenuNotificationObserver.
1507 } 1506 }
1508 1507
1509 void Step4() { 1508 void Step4() {
1510 // The context menu should still be showing. 1509 // The context menu should still be showing.
1511 views::MenuItemView* context_menu = bb_view_->GetContextMenu(); 1510 views::MenuItemView* context_menu = bb_view_->GetContextMenu();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 Done(); 1650 Done();
1652 } 1651 }
1653 }; 1652 };
1654 1653
1655 #if defined(OS_WIN) 1654 #if defined(OS_WIN)
1656 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu 1655 #define MAYBE_BookmarkBarViewTest19_SiblingMenu DISABLED_SiblingMenu
1657 #else 1656 #else
1658 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu 1657 #define MAYBE_BookmarkBarViewTest19_SiblingMenu SiblingMenu
1659 #endif 1658 #endif
1660 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu) 1659 VIEW_TEST(BookmarkBarViewTest19, MAYBE_BookmarkBarViewTest19_SiblingMenu)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698