Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/browser/ui/views/menu_test_base.cc

Issue 331993009: MacViews: Run native Cocoa context menus to support Services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add VIEWS_EXPORT for unit test access Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 ui_controls::SendKeyPressNotifyWhenDone( 35 ui_controls::SendKeyPressNotifyWhenDone(
36 GetWidget()->GetNativeView()->GetRootWindow(), keycode, false, false, 36 GetWidget()->GetNativeView()->GetRootWindow(), keycode, false, false,
37 false, false, next); 37 false, false, next);
38 } 38 }
39 39
40 void MenuTestBase::SetUp() { 40 void MenuTestBase::SetUp() {
41 button_ = new views::MenuButton( 41 button_ = new views::MenuButton(
42 NULL, base::ASCIIToUTF16("Menu Test"), this, true); 42 NULL, base::ASCIIToUTF16("Menu Test"), this, true);
43 menu_ = new views::MenuItemView(this); 43 menu_ = new views::MenuItemView(this);
44 BuildMenu(menu_); 44 BuildMenu(menu_);
45 menu_runner_.reset(new views::MenuRunner(menu_)); 45 menu_runner_.reset(
46 new views::MenuRunner(menu_, views::MenuRunner::HAS_MNEMONICS));
46 47
47 ViewEventTestBase::SetUp(); 48 ViewEventTestBase::SetUp();
48 } 49 }
49 50
50 void MenuTestBase::TearDown() { 51 void MenuTestBase::TearDown() {
51 menu_runner_.reset(); 52 menu_runner_.reset();
52 menu_ = NULL; 53 menu_ = NULL;
53 ViewEventTestBase::TearDown(); 54 ViewEventTestBase::TearDown();
54 } 55 }
55 56
(...skipping 11 matching lines...) Expand all
67 68
68 void MenuTestBase::OnMenuButtonClicked(views::View* source, 69 void MenuTestBase::OnMenuButtonClicked(views::View* source,
69 const gfx::Point& point) { 70 const gfx::Point& point) {
70 gfx::Point screen_location; 71 gfx::Point screen_location;
71 views::View::ConvertPointToScreen(source, &screen_location); 72 views::View::ConvertPointToScreen(source, &screen_location);
72 gfx::Rect bounds(screen_location, source->size()); 73 gfx::Rect bounds(screen_location, source->size());
73 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(), 74 ignore_result(menu_runner_->RunMenuAt(source->GetWidget(),
74 button_, 75 button_,
75 bounds, 76 bounds,
76 views::MENU_ANCHOR_TOPLEFT, 77 views::MENU_ANCHOR_TOPLEFT,
77 ui::MENU_SOURCE_NONE, 78 ui::MENU_SOURCE_NONE));
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698