OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/ui/views/menu_test_base.h" | 6 #include "chrome/browser/ui/views/menu_test_base.h" |
7 #include "chrome/test/base/interactive_test_utils.h" | 7 #include "chrome/test/base/interactive_test_utils.h" |
8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/base/test/ui_controls.h" | 10 #include "ui/base/test/ui_controls.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 gfx::Size MenuTestBase::GetPreferredSize() { | 64 gfx::Size MenuTestBase::GetPreferredSize() { |
65 return button_->GetPreferredSize(); | 65 return button_->GetPreferredSize(); |
66 } | 66 } |
67 | 67 |
68 void MenuTestBase::OnMenuButtonClicked(views::View* source, | 68 void MenuTestBase::OnMenuButtonClicked(views::View* source, |
69 const gfx::Point& point) { | 69 const gfx::Point& point) { |
70 gfx::Point screen_location; | 70 gfx::Point screen_location; |
71 views::View::ConvertPointToScreen(source, &screen_location); | 71 views::View::ConvertPointToScreen(source, &screen_location); |
72 gfx::Rect bounds(screen_location, source->size()); | 72 gfx::Rect bounds(screen_location, source->size()); |
73 ignore_result(menu_runner_->RunMenuAt( | 73 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(), |
74 source->GetWidget(), | 74 button_, |
75 button_, | 75 bounds, |
76 bounds, | 76 views::MENU_ANCHOR_TOPLEFT, |
77 views::MenuItemView::TOPLEFT, | 77 ui::MENU_SOURCE_NONE, |
78 ui::MENU_SOURCE_NONE, | 78 views::MenuRunner::HAS_MNEMONICS)); |
79 views::MenuRunner::HAS_MNEMONICS)); | |
80 } | 79 } |
81 | 80 |
82 void MenuTestBase::ExecuteCommand(int id) { | 81 void MenuTestBase::ExecuteCommand(int id) { |
83 last_command_ = id; | 82 last_command_ = id; |
84 } | 83 } |
OLD | NEW |