This source file includes following definitions.
- IsCommandIdChecked
- IsCommandIdEnabled
- GetAcceleratorForCommandId
- ExecuteCommand
- CountEnabledExecutable
#include "chrome/test/base/menu_model_test.h"
#include "testing/gtest/include/gtest/gtest.h"
bool MenuModelTest::Delegate::IsCommandIdChecked(int command_id) const {
return false;
}
bool MenuModelTest::Delegate::IsCommandIdEnabled(int command_id) const {
++enable_count_;
return true;
}
bool MenuModelTest::Delegate::GetAcceleratorForCommandId(
int command_id,
ui::Accelerator* accelerator) {
return false;
}
void MenuModelTest::Delegate::ExecuteCommand(int command_id, int event_flags) {
++execute_count_;
}
void MenuModelTest::CountEnabledExecutable(ui::MenuModel* model,
int* count) {
for (int i = 0; i < model->GetItemCount(); ++i) {
ui::MenuModel::ItemType type = model->GetTypeAt(i);
switch (type) {
case ui::MenuModel::TYPE_SEPARATOR:
continue;
case ui::MenuModel::TYPE_SUBMENU:
CountEnabledExecutable(model->GetSubmenuModelAt(i), count);
break;
case ui::MenuModel::TYPE_COMMAND:
case ui::MenuModel::TYPE_CHECK:
case ui::MenuModel::TYPE_RADIO:
model->IsEnabledAt(i);
model->ActivatedAt(i);
(*count)++;
break;
default:
FAIL();
}
}
}