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

Side by Side Diff: chrome/test/menu_model_test.cc

Issue 7537033: Move more files from chrome/test to chrome/test/base, part #5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« no previous file with comments | « chrome/test/menu_model_test.h ('k') | chrome/test/out_of_proc_test_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/test/menu_model_test.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 // Recursively checks the enabled state and executes a command on every item
9 // that's not a separator or a submenu parent item. The returned count should
10 // match the number of times the delegate is called to ensure every item works.
11 void MenuModelTest::CountEnabledExecutable(ui::MenuModel* model,
12 int* count) {
13 for (int i = 0; i < model->GetItemCount(); ++i) {
14 ui::MenuModel::ItemType type = model->GetTypeAt(i);
15 switch (type) {
16 case ui::MenuModel::TYPE_SEPARATOR:
17 continue;
18 case ui::MenuModel::TYPE_SUBMENU:
19 CountEnabledExecutable(model->GetSubmenuModelAt(i), count);
20 break;
21 case ui::MenuModel::TYPE_COMMAND:
22 case ui::MenuModel::TYPE_CHECK:
23 case ui::MenuModel::TYPE_RADIO:
24 model->IsEnabledAt(i); // Check if it's enabled (ignore answer).
25 model->ActivatedAt(i); // Execute it.
26 (*count)++; // Increment the count of executable items seen.
27 break;
28 default:
29 FAIL(); // Ensure every case is tested.
30 }
31 }
32 }
OLDNEW
« no previous file with comments | « chrome/test/menu_model_test.h ('k') | chrome/test/out_of_proc_test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698