| 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
| 6 #include "chrome/test/interactive_ui/view_event_test_base.h" | 6 #include "chrome/test/interactive_ui/view_event_test_base.h" |
| 7 #include "views/controls/button/menu_button.h" | 7 #include "views/controls/button/menu_button.h" |
| 8 #include "views/controls/menu/menu_controller.h" | 8 #include "views/controls/menu/menu_controller.h" |
| 9 #include "views/controls/menu/menu_item_view.h" | 9 #include "views/controls/menu/menu_item_view.h" |
| 10 #include "views/controls/menu/submenu_view.h" | 10 #include "views/controls/menu/submenu_view.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 virtual gfx::Size GetPreferredSize() OVERRIDE { | 61 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 62 return button_->GetPreferredSize(); | 62 return button_->GetPreferredSize(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // views::ViewMenuDelegate implementation. | 65 // views::ViewMenuDelegate implementation. |
| 66 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE { | 66 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE { |
| 67 gfx::Point screen_location; | 67 gfx::Point screen_location; |
| 68 views::View::ConvertPointToScreen(source, &screen_location); | 68 views::View::ConvertPointToScreen(source, &screen_location); |
| 69 gfx::Rect bounds(screen_location, source->size()); | 69 gfx::Rect bounds(screen_location, source->size()); |
| 70 menu_->RunMenuAt( | 70 menu_->RunMenuAt( |
| 71 source->GetWindow()->GetNativeWindow(), | 71 source->GetWidget()->GetNativeWindow(), |
| 72 button_, | 72 button_, |
| 73 bounds, | 73 bounds, |
| 74 views::MenuItemView::TOPLEFT, | 74 views::MenuItemView::TOPLEFT, |
| 75 true); | 75 true); |
| 76 } | 76 } |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 // Generate a mouse click on the specified view and post a new task. | 79 // Generate a mouse click on the specified view and post a new task. |
| 80 virtual void Click(views::View* view, Task* next) { | 80 virtual void Click(views::View* view, Task* next) { |
| 81 ui_controls::MoveMouseToCenterAndPress( | 81 ui_controls::MoveMouseToCenterAndPress( |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 private: | 470 private: |
| 471 int last_command_; | 471 int last_command_; |
| 472 views::MenuItemView* submenu_; | 472 views::MenuItemView* submenu_; |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 typedef MenuItemViewTestRemoveWithSubmenu<0> MenuItemViewTestRemoveWithSubmenu0; | 475 typedef MenuItemViewTestRemoveWithSubmenu<0> MenuItemViewTestRemoveWithSubmenu0; |
| 476 typedef MenuItemViewTestRemoveWithSubmenu<1> MenuItemViewTestRemoveWithSubmenu1; | 476 typedef MenuItemViewTestRemoveWithSubmenu<1> MenuItemViewTestRemoveWithSubmenu1; |
| 477 VIEW_TEST(MenuItemViewTestRemoveWithSubmenu0, RemoveItemWithSubmenu0) | 477 VIEW_TEST(MenuItemViewTestRemoveWithSubmenu0, RemoveItemWithSubmenu0) |
| 478 VIEW_TEST(MenuItemViewTestRemoveWithSubmenu1, RemoveItemWithSubmenu1) | 478 VIEW_TEST(MenuItemViewTestRemoveWithSubmenu1, RemoveItemWithSubmenu1) |
| OLD | NEW |