| OLD | NEW |
| 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/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.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 "chrome/test/base/view_event_test_base.h" | 9 #include "chrome/test/base/view_event_test_base.h" |
| 10 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 virtual void OnMenuButtonClicked(views::View* source, | 233 virtual void OnMenuButtonClicked(views::View* source, |
| 234 const gfx::Point& point) OVERRIDE { | 234 const gfx::Point& point) OVERRIDE { |
| 235 gfx::Point screen_location; | 235 gfx::Point screen_location; |
| 236 views::View::ConvertPointToScreen(source, &screen_location); | 236 views::View::ConvertPointToScreen(source, &screen_location); |
| 237 gfx::Rect bounds(screen_location, source->size()); | 237 gfx::Rect bounds(screen_location, source->size()); |
| 238 ignore_result(menu_runner_->RunMenuAt( | 238 ignore_result(menu_runner_->RunMenuAt( |
| 239 source->GetWidget(), | 239 source->GetWidget(), |
| 240 button_, | 240 button_, |
| 241 bounds, | 241 bounds, |
| 242 views::MenuItemView::TOPLEFT, | 242 views::MenuItemView::TOPLEFT, |
| 243 ui::MENU_SOURCE_NONE, |
| 243 views::MenuRunner::HAS_MNEMONICS)); | 244 views::MenuRunner::HAS_MNEMONICS)); |
| 244 } | 245 } |
| 245 | 246 |
| 246 // ViewEventTestBase implementation | 247 // ViewEventTestBase implementation |
| 247 virtual void DoTestOnMessageLoop() OVERRIDE { | 248 virtual void DoTestOnMessageLoop() OVERRIDE { |
| 248 Click(button_, CreateEventTask(this, &MenuModelAdapterTest::Step1)); | 249 Click(button_, CreateEventTask(this, &MenuModelAdapterTest::Step1)); |
| 249 } | 250 } |
| 250 | 251 |
| 251 // Open the submenu. | 252 // Open the submenu. |
| 252 void Step1() { | 253 void Step1() { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 views::MenuItemView* menu_; | 316 views::MenuItemView* menu_; |
| 316 scoped_ptr<views::MenuRunner> menu_runner_; | 317 scoped_ptr<views::MenuRunner> menu_runner_; |
| 317 }; | 318 }; |
| 318 | 319 |
| 319 #if defined(OS_WIN) | 320 #if defined(OS_WIN) |
| 320 #define MAYBE_RebuildMenu DISABLED_RebuildMenu | 321 #define MAYBE_RebuildMenu DISABLED_RebuildMenu |
| 321 #else | 322 #else |
| 322 #define MAYBE_RebuildMenu RebuildMenu | 323 #define MAYBE_RebuildMenu RebuildMenu |
| 323 #endif | 324 #endif |
| 324 VIEW_TEST(MenuModelAdapterTest, MAYBE_RebuildMenu) | 325 VIEW_TEST(MenuModelAdapterTest, MAYBE_RebuildMenu) |
| OLD | NEW |