| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 views::View* MenuTestBase::CreateContentsView() { | 56 views::View* MenuTestBase::CreateContentsView() { |
| 57 return button_; | 57 return button_; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void MenuTestBase::DoTestOnMessageLoop() { | 60 void MenuTestBase::DoTestOnMessageLoop() { |
| 61 Click(button_, CreateEventTask(this, &MenuTestBase::DoTestWithMenuOpen)); | 61 Click(button_, CreateEventTask(this, &MenuTestBase::DoTestWithMenuOpen)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 gfx::Size MenuTestBase::GetPreferredSize() { | 64 gfx::Size MenuTestBase::GetPreferredSize() const { |
| 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(source->GetWidget(), | 73 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(), |
| 74 button_, | 74 button_, |
| 75 bounds, | 75 bounds, |
| 76 views::MENU_ANCHOR_TOPLEFT, | 76 views::MENU_ANCHOR_TOPLEFT, |
| 77 ui::MENU_SOURCE_NONE, | 77 ui::MENU_SOURCE_NONE, |
| 78 views::MenuRunner::HAS_MNEMONICS)); | 78 views::MenuRunner::HAS_MNEMONICS)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void MenuTestBase::ExecuteCommand(int id) { | 81 void MenuTestBase::ExecuteCommand(int id) { |
| 82 last_command_ = id; | 82 last_command_ = id; |
| 83 } | 83 } |
| OLD | NEW |