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

Side by Side Diff: ui/views/controls/menu/menu_runner_cocoa_unittest.mm

Issue 2140963002: Added default implementations of GetAcceleratorForCommandId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@acceleratorprovider-const
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « ui/message_center/views/notifier_settings_view.cc ('k') | ui/views/examples/menu_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h" 5 #import "ui/views/controls/menu/menu_runner_impl_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 private: 30 private:
31 class Delegate : public ui::SimpleMenuModel::Delegate { 31 class Delegate : public ui::SimpleMenuModel::Delegate {
32 public: 32 public:
33 explicit Delegate(TestModel* model) : model_(model) {} 33 explicit Delegate(TestModel* model) : model_(model) {}
34 bool IsCommandIdChecked(int command_id) const override { 34 bool IsCommandIdChecked(int command_id) const override {
35 return command_id == model_->checked_command_; 35 return command_id == model_->checked_command_;
36 } 36 }
37 bool IsCommandIdEnabled(int command_id) const override { return true; } 37 bool IsCommandIdEnabled(int command_id) const override { return true; }
38 bool GetAcceleratorForCommandId(
39 int command_id,
40 ui::Accelerator* accelerator) const override {
41 return false;
42 }
43 void ExecuteCommand(int command_id, int event_flags) override {} 38 void ExecuteCommand(int command_id, int event_flags) override {}
44 39
45 void MenuWillShow(SimpleMenuModel* source) override { 40 void MenuWillShow(SimpleMenuModel* source) override {
46 model_->menu_open_callback_.Run(); 41 model_->menu_open_callback_.Run();
47 } 42 }
48 43
49 private: 44 private:
50 TestModel* model_; 45 TestModel* model_;
51 46
52 DISALLOW_COPY_AND_ASSIGN(Delegate); 47 DISALLOW_COPY_AND_ASSIGN(Delegate);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is 253 // In RTL, Cocoa messes up the positioning unless the anchor rectangle is
259 // offset to the right of the view. The offset for the checkmark is also 254 // offset to the right of the view. The offset for the checkmark is also
260 // skipped, to give a better match to native behavior. 255 // skipped, to give a better match to native behavior.
261 base::i18n::SetICUDefaultLocale("he"); 256 base::i18n::SetICUDefaultLocale("he");
262 RunMenuAt(anchor_rect); 257 RunMenuAt(anchor_rect);
263 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x); 258 EXPECT_EQ(combobox_rect.right(), last_anchor_frame_.origin.x);
264 } 259 }
265 260
266 } // namespace test 261 } // namespace test
267 } // namespace views 262 } // namespace views
OLDNEW
« no previous file with comments | « ui/message_center/views/notifier_settings_view.cc ('k') | ui/views/examples/menu_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698