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