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

Side by Side Diff: chrome/test/base/menu_model_test.h

Issue 10855075: Clean-up inline members of nested classes (chrome/) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_TEST_BASE_MENU_MODEL_TEST_H_ 5 #ifndef CHROME_TEST_BASE_MENU_MODEL_TEST_H_
6 #define CHROME_TEST_BASE_MENU_MODEL_TEST_H_ 6 #define CHROME_TEST_BASE_MENU_MODEL_TEST_H_
7 7
8 #include "ui/base/accelerators/accelerator.h" 8 #include "ui/base/accelerators/accelerator.h"
9 #include "ui/base/models/simple_menu_model.h" 9 #include "ui/base/models/simple_menu_model.h"
10 10
11 // A mix-in class to be used in addition to something that derrives from 11 // A mix-in class to be used in addition to something that derrives from
12 // testing::Test to provide some extra functionality for testing menu models. 12 // testing::Test to provide some extra functionality for testing menu models.
13 class MenuModelTest { 13 class MenuModelTest {
14 public: 14 public:
15 MenuModelTest() {} 15 MenuModelTest() {}
16 virtual ~MenuModelTest() {} 16 virtual ~MenuModelTest() {}
17 17
18 protected: 18 protected:
19 // A menu delegate that counts the number of times certain things are called 19 // A menu delegate that counts the number of times certain things are called
20 // to make sure things are hooked up properly. 20 // to make sure things are hooked up properly.
21 class Delegate : public ui::SimpleMenuModel::Delegate, 21 class Delegate : public ui::SimpleMenuModel::Delegate,
22 public ui::AcceleratorProvider { 22 public ui::AcceleratorProvider {
23 public: 23 public:
24 Delegate() : execute_count_(0), enable_count_(0) {} 24 Delegate() : execute_count_(0), enable_count_(0) {}
25 25
26 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { 26 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
27 return false; 27 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
28 }
29 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE {
30 ++enable_count_;
31 return true;
32 }
33 virtual bool GetAcceleratorForCommandId( 28 virtual bool GetAcceleratorForCommandId(
34 int command_id, 29 int command_id,
35 ui::Accelerator* accelerator) OVERRIDE { return false; } 30 ui::Accelerator* accelerator) OVERRIDE;
36 virtual void ExecuteCommand(int command_id) OVERRIDE { ++execute_count_; } 31 virtual void ExecuteCommand(int command_id) OVERRIDE;
37 32
38 int execute_count_; 33 int execute_count_;
39 mutable int enable_count_; 34 mutable int enable_count_;
40 }; 35 };
41 36
42 // Recursively checks the enabled state and executes a command on every item 37 // Recursively checks the enabled state and executes a command on every item
43 // that's not a separator or a submenu parent item. The returned count should 38 // that's not a separator or a submenu parent item. The returned count should
44 // match the number of times the delegate is called to ensure every item 39 // match the number of times the delegate is called to ensure every item
45 // works. 40 // works.
46 void CountEnabledExecutable(ui::MenuModel* model, int* count); 41 void CountEnabledExecutable(ui::MenuModel* model, int* count);
47 42
48 Delegate delegate_; 43 Delegate delegate_;
49 }; 44 };
50 45
51 #endif // CHROME_TEST_BASE_MENU_MODEL_TEST_H_ 46 #endif // CHROME_TEST_BASE_MENU_MODEL_TEST_H_
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/cloud_print_url_fetcher.cc ('k') | chrome/test/base/menu_model_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698