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

Side by Side Diff: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc

Issue 628773002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[t-v]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
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 "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" 5 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 public: 45 public:
46 TestRecentTabsSubMenuModel(ui::AcceleratorProvider* provider, 46 TestRecentTabsSubMenuModel(ui::AcceleratorProvider* provider,
47 Browser* browser, 47 Browser* browser,
48 browser_sync::OpenTabsUIDelegate* delegate) 48 browser_sync::OpenTabsUIDelegate* delegate)
49 : RecentTabsSubMenuModel(provider, browser, delegate), 49 : RecentTabsSubMenuModel(provider, browser, delegate),
50 execute_count_(0), 50 execute_count_(0),
51 enable_count_(0) { 51 enable_count_(0) {
52 } 52 }
53 53
54 // Testing overrides to ui::SimpleMenuModel::Delegate: 54 // Testing overrides to ui::SimpleMenuModel::Delegate:
55 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { 55 virtual bool IsCommandIdEnabled(int command_id) const override {
56 bool val = RecentTabsSubMenuModel::IsCommandIdEnabled(command_id); 56 bool val = RecentTabsSubMenuModel::IsCommandIdEnabled(command_id);
57 if (val) 57 if (val)
58 ++enable_count_; 58 ++enable_count_;
59 return val; 59 return val;
60 } 60 }
61 61
62 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { 62 virtual void ExecuteCommand(int command_id, int event_flags) override {
63 ++execute_count_; 63 ++execute_count_;
64 } 64 }
65 65
66 int execute_count() const { return execute_count_; } 66 int execute_count() const { return execute_count_; }
67 int enable_count() const { return enable_count_; } 67 int enable_count() const { return enable_count_; }
68 68
69 private: 69 private:
70 int execute_count_; 70 int execute_count_;
71 int mutable enable_count_; // Mutable because IsCommandIdEnabledAt is const. 71 int mutable enable_count_; // Mutable because IsCommandIdEnabledAt is const.
72 72
73 DISALLOW_COPY_AND_ASSIGN(TestRecentTabsSubMenuModel); 73 DISALLOW_COPY_AND_ASSIGN(TestRecentTabsSubMenuModel);
74 }; 74 };
75 75
76 class TestRecentTabsMenuModelDelegate : public ui::MenuModelDelegate { 76 class TestRecentTabsMenuModelDelegate : public ui::MenuModelDelegate {
77 public: 77 public:
78 explicit TestRecentTabsMenuModelDelegate(ui::MenuModel* model) 78 explicit TestRecentTabsMenuModelDelegate(ui::MenuModel* model)
79 : model_(model), 79 : model_(model),
80 got_changes_(false) { 80 got_changes_(false) {
81 model_->SetMenuModelDelegate(this); 81 model_->SetMenuModelDelegate(this);
82 } 82 }
83 83
84 virtual ~TestRecentTabsMenuModelDelegate() { 84 virtual ~TestRecentTabsMenuModelDelegate() {
85 model_->SetMenuModelDelegate(NULL); 85 model_->SetMenuModelDelegate(NULL);
86 } 86 }
87 87
88 // ui::MenuModelDelegate implementation: 88 // ui::MenuModelDelegate implementation:
89 89
90 virtual void OnIconChanged(int index) OVERRIDE { 90 virtual void OnIconChanged(int index) override {
91 } 91 }
92 92
93 virtual void OnMenuStructureChanged() OVERRIDE { 93 virtual void OnMenuStructureChanged() override {
94 got_changes_ = true; 94 got_changes_ = true;
95 } 95 }
96 96
97 bool got_changes() const { return got_changes_; } 97 bool got_changes() const { return got_changes_; }
98 98
99 private: 99 private:
100 ui::MenuModel* model_; 100 ui::MenuModel* model_;
101 bool got_changes_; 101 bool got_changes_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(TestRecentTabsMenuModelDelegate); 103 DISALLOW_COPY_AND_ASSIGN(TestRecentTabsMenuModelDelegate);
104 }; 104 };
105 105
106 class DummyRouter : public browser_sync::LocalSessionEventRouter { 106 class DummyRouter : public browser_sync::LocalSessionEventRouter {
107 public: 107 public:
108 virtual ~DummyRouter() {} 108 virtual ~DummyRouter() {}
109 virtual void StartRoutingTo( 109 virtual void StartRoutingTo(
110 browser_sync::LocalSessionEventHandler* handler) OVERRIDE {} 110 browser_sync::LocalSessionEventHandler* handler) override {}
111 virtual void Stop() OVERRIDE {} 111 virtual void Stop() override {}
112 }; 112 };
113 113
114 } // namespace 114 } // namespace
115 115
116 class RecentTabsSubMenuModelTest 116 class RecentTabsSubMenuModelTest
117 : public BrowserWithTestWindowTest { 117 : public BrowserWithTestWindowTest {
118 public: 118 public:
119 RecentTabsSubMenuModelTest() 119 RecentTabsSubMenuModelTest()
120 : sync_service_(&testing_profile_), 120 : sync_service_(&testing_profile_),
121 local_device_(new sync_driver::LocalDeviceInfoProviderMock( 121 local_device_(new sync_driver::LocalDeviceInfoProviderMock(
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // 0 Recently closed heaer (disabled) 554 // 0 Recently closed heaer (disabled)
555 // 1 <separator> 555 // 1 <separator>
556 // 2 No tabs from other Devices 556 // 2 No tabs from other Devices
557 557
558 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); 558 TestRecentTabsSubMenuModel model(NULL, browser(), NULL);
559 EXPECT_EQ(3, model.GetItemCount()); 559 EXPECT_EQ(3, model.GetItemCount());
560 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); 560 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0));
561 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); 561 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1));
562 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); 562 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2));
563 } 563 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h ('k') | chrome/browser/ui/toolbar/test_toolbar_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698