| OLD | NEW |
| 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/common/extensions/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/extensions/api/commands/commands_handler.h" | 10 #include "chrome/common/extensions/api/commands/commands_handler.h" |
| 11 #include "chrome/common/extensions/extension_manifest_constants.h" | 11 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 12 #include "chrome/common/extensions/manifest_handler.h" | 12 #include "chrome/common/extensions/manifest_handler.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace errors = extension_manifest_errors; | 15 namespace errors = extension_manifest_errors; |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 class CommandsManifestTest : public ExtensionManifestTest { | 19 class CommandsManifestTest : public ExtensionManifestTest { |
| 20 protected: | 20 protected: |
| 21 virtual void SetUp() OVERRIDE { | 21 virtual void SetUp() OVERRIDE { |
| 22 ManifestHandler::Register(extension_manifest_keys::kCommands, | 22 ManifestHandler::Register(extension_manifest_keys::kCommands, |
| 23 new CommandsHandler); | 23 make_linked_ptr(new CommandsHandler)); |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 TEST_F(CommandsManifestTest, CommandManifestSimple) { | 27 TEST_F(CommandsManifestTest, CommandManifestSimple) { |
| 28 CommandLine::ForCurrentProcess()->AppendSwitch( | 28 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 29 switches::kEnableExperimentalExtensionApis); | 29 switches::kEnableExperimentalExtensionApis); |
| 30 | 30 |
| 31 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 32 int ctrl = ui::EF_COMMAND_DOWN; | 32 int ctrl = ui::EF_COMMAND_DOWN; |
| 33 #else | 33 #else |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 TEST_F(CommandsManifestTest, CommandManifestRejectJustShift) { | 89 TEST_F(CommandsManifestTest, CommandManifestRejectJustShift) { |
| 90 CommandLine::ForCurrentProcess()->AppendSwitch( | 90 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 91 switches::kEnableExperimentalExtensionApis); | 91 switches::kEnableExperimentalExtensionApis); |
| 92 | 92 |
| 93 LoadAndExpectError("command_reject_just_shift.json", | 93 LoadAndExpectError("command_reject_just_shift.json", |
| 94 errors::kInvalidKeyBinding); | 94 errors::kInvalidKeyBinding); |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace extensions | 97 } // namespace extensions |
| OLD | NEW |