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

Side by Side Diff: chrome/common/extensions/api/commands/commands_manifest_unittest.cc

Issue 253593003: Release the Commands API and add docs for Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 6 years, 7 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) 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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 LoadAndExpectSuccess("browser_action_synthesizes_command.json"); 90 LoadAndExpectSuccess("browser_action_synthesizes_command.json");
91 // An extension with a browser action but no extension command specified 91 // An extension with a browser action but no extension command specified
92 // should get a command assigned to it. 92 // should get a command assigned to it.
93 const extensions::Command* command = 93 const extensions::Command* command =
94 CommandsInfo::GetBrowserActionCommand(extension.get()); 94 CommandsInfo::GetBrowserActionCommand(extension.get());
95 ASSERT_TRUE(command != NULL); 95 ASSERT_TRUE(command != NULL);
96 ASSERT_EQ(ui::VKEY_UNKNOWN, command->accelerator().key_code()); 96 ASSERT_EQ(ui::VKEY_UNKNOWN, command->accelerator().key_code());
97 } 97 }
98 98
99 // This test makes sure that the "commands" feature and the "commands.global" 99 // This test makes sure that the "commands" feature and the "commands.global"
100 // property behave as expected on dev and stable (enabled and working on dev, 100 // property load properly.
101 // not working on stable). 101 TEST_F(CommandsManifestTest, LoadsOnStable) {
102 TEST_F(CommandsManifestTest, ChannelTests) { 102 scoped_refptr<Extension> extension1 =
103 // This tests the following combinations. 103 LoadAndExpectSuccess("command_ext.json");
104 // Ext+Command Stable : OK. 104 scoped_refptr<Extension> extension2 =
105 // Ext+Command+Global Stable : Property is silently ignored (expect success). 105 LoadAndExpectSuccess("command_app.json");
106 // App+Command Stable : NOT OK. 106 scoped_refptr<Extension> extension3 =
107 // App+Command+Global Stable : NOT OK. 107 LoadAndExpectSuccess("command_ext_global.json");
108 { 108 scoped_refptr<Extension> extension4 =
109 std::string warning = "'commands' requires Google Chrome dev channel or " 109 LoadAndExpectSuccess("command_app_global.json");
110 "newer, but this is the stable channel.";
111 ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_STABLE);
112 scoped_refptr<Extension> extension1 =
113 LoadAndExpectSuccess("command_ext.json");
114 scoped_refptr<Extension> extension2 =
115 LoadAndExpectSuccess("command_ext_global.json");
116 LoadAndExpectWarning("command_app.json", warning);
117 LoadAndExpectWarning("command_app_global.json", warning);
118 }
119
120 // Ext+Command Dev : OK.
121 // App+Command Dev : OK.
122 // Ext+Command+Global Dev : OK.
123 // App+Command+Global Dev : OK.
124 {
125 ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_DEV);
126 scoped_refptr<Extension> extension1 =
127 LoadAndExpectSuccess("command_ext.json");
128 scoped_refptr<Extension> extension2 =
129 LoadAndExpectSuccess("command_app.json");
130 scoped_refptr<Extension> extension3 =
131 LoadAndExpectSuccess("command_ext_global.json");
132 scoped_refptr<Extension> extension4 =
133 LoadAndExpectSuccess("command_app_global.json");
134 }
135 } 110 }
136 111
137 TEST_F(CommandsManifestTest, CommandManifestShouldNotCountMediaKeys) { 112 TEST_F(CommandsManifestTest, CommandManifestShouldNotCountMediaKeys) {
138 scoped_refptr<Extension> extension = 113 scoped_refptr<Extension> extension =
139 LoadAndExpectSuccess("command_should_not_count_media_keys.json"); 114 LoadAndExpectSuccess("command_should_not_count_media_keys.json");
140 } 115 }
141 116
142 } // namespace extensions 117 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698