OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/automation/ui_controls.h" | 8 #include "chrome/browser/automation/ui_controls.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 first_menu_ = menu->GetSubmenu()->GetMenuItemAt(0); | 834 first_menu_ = menu->GetSubmenu()->GetMenuItemAt(0); |
835 gfx::Point menu_loc; | 835 gfx::Point menu_loc; |
836 views::View::ConvertPointToScreen(first_menu_, &menu_loc); | 836 views::View::ConvertPointToScreen(first_menu_, &menu_loc); |
837 start_y_ = menu_loc.y(); | 837 start_y_ = menu_loc.y(); |
838 | 838 |
839 // Move the mouse over the scroll button. | 839 // Move the mouse over the scroll button. |
840 views::View* scroll_container = menu->GetSubmenu()->parent(); | 840 views::View* scroll_container = menu->GetSubmenu()->parent(); |
841 ASSERT_TRUE(scroll_container != NULL); | 841 ASSERT_TRUE(scroll_container != NULL); |
842 scroll_container = scroll_container->parent(); | 842 scroll_container = scroll_container->parent(); |
843 ASSERT_TRUE(scroll_container != NULL); | 843 ASSERT_TRUE(scroll_container != NULL); |
844 views::View* scroll_down_button = scroll_container->GetChildViewAt(1); | 844 views::View* scroll_down_button = scroll_container->child_at(1); |
845 ASSERT_TRUE(scroll_down_button); | 845 ASSERT_TRUE(scroll_down_button); |
846 gfx::Point loc(scroll_down_button->width() / 2, | 846 gfx::Point loc(scroll_down_button->width() / 2, |
847 scroll_down_button->height() / 2); | 847 scroll_down_button->height() / 2); |
848 views::View::ConvertPointToScreen(scroll_down_button, &loc); | 848 views::View::ConvertPointToScreen(scroll_down_button, &loc); |
849 | 849 |
850 // On linux, the sending one location isn't enough. | 850 // On linux, the sending one location isn't enough. |
851 ui_controls::SendMouseMove(loc.x() - 1 , loc.y() - 1); | 851 ui_controls::SendMouseMove(loc.x() - 1 , loc.y() - 1); |
852 ui_controls::SendMouseMoveNotifyWhenDone( | 852 ui_controls::SendMouseMoveNotifyWhenDone( |
853 loc.x(), loc.y(), CreateEventTask(this, &BookmarkBarViewTest9::Step3)); | 853 loc.x(), loc.y(), CreateEventTask(this, &BookmarkBarViewTest9::Step3)); |
854 } | 854 } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 // Make sure the context menu is showing. | 1183 // Make sure the context menu is showing. |
1184 views::MenuItemView* menu = bb_view_->GetContextMenu(); | 1184 views::MenuItemView* menu = bb_view_->GetContextMenu(); |
1185 ASSERT_TRUE(menu != NULL); | 1185 ASSERT_TRUE(menu != NULL); |
1186 ASSERT_TRUE(menu->GetSubmenu()); | 1186 ASSERT_TRUE(menu->GetSubmenu()); |
1187 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1187 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1188 | 1188 |
1189 // Find the first separator. | 1189 // Find the first separator. |
1190 views::SubmenuView* submenu = menu->GetSubmenu(); | 1190 views::SubmenuView* submenu = menu->GetSubmenu(); |
1191 views::View* separator_view = NULL; | 1191 views::View* separator_view = NULL; |
1192 for (int i = 0; i < submenu->child_count(); ++i) { | 1192 for (int i = 0; i < submenu->child_count(); ++i) { |
1193 if (submenu->GetChildViewAt(i)->id() != | 1193 if (submenu->child_at(i)->id() != views::MenuItemView::kMenuItemViewID) { |
1194 views::MenuItemView::kMenuItemViewID) { | 1194 separator_view = submenu->child_at(i); |
1195 separator_view = submenu->GetChildViewAt(i); | |
1196 break; | 1195 break; |
1197 } | 1196 } |
1198 } | 1197 } |
1199 ASSERT_TRUE(separator_view); | 1198 ASSERT_TRUE(separator_view); |
1200 | 1199 |
1201 // Click on the separator. Clicking on the separator shouldn't visually | 1200 // Click on the separator. Clicking on the separator shouldn't visually |
1202 // change anything. | 1201 // change anything. |
1203 ui_controls::MoveMouseToCenterAndPress(separator_view, | 1202 ui_controls::MoveMouseToCenterAndPress(separator_view, |
1204 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, | 1203 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, |
1205 CreateEventTask(this, &BookmarkBarViewTest13::Step4)); | 1204 CreateEventTask(this, &BookmarkBarViewTest13::Step4)); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 | 1445 |
1447 bb_view_->GetMenu()->GetMenuController()->CancelAll(); | 1446 bb_view_->GetMenu()->GetMenuController()->CancelAll(); |
1448 | 1447 |
1449 Done(); | 1448 Done(); |
1450 } | 1449 } |
1451 | 1450 |
1452 ContextMenuNotificationObserver observer_; | 1451 ContextMenuNotificationObserver observer_; |
1453 }; | 1452 }; |
1454 | 1453 |
1455 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) | 1454 VIEW_TEST(BookmarkBarViewTest17, ContextMenus3) |
OLD | NEW |