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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/extensions/api/commands/commands_handler.h" 11 #include "chrome/common/extensions/api/commands/commands_handler.h"
11 #include "chrome/common/extensions/features/feature_channel.h" 12 #include "chrome/common/extensions/features/feature_channel.h"
12 #include "extensions/common/manifest_constants.h" 13 #include "extensions/common/manifest_constants.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 namespace errors = manifest_errors; 18 namespace errors = manifest_errors;
18 19
(...skipping 17 matching lines...) Expand all
36 LoadAndExpectSuccess("command_simple.json"); 37 LoadAndExpectSuccess("command_simple.json");
37 ASSERT_TRUE(extension.get()); 38 ASSERT_TRUE(extension.get());
38 39
39 const CommandMap* commands = CommandsInfo::GetNamedCommands(extension.get()); 40 const CommandMap* commands = CommandsInfo::GetNamedCommands(extension.get());
40 ASSERT_TRUE(commands); 41 ASSERT_TRUE(commands);
41 ASSERT_EQ(1u, commands->size()); 42 ASSERT_EQ(1u, commands->size());
42 CommandMap::const_iterator iter = commands->begin(); 43 CommandMap::const_iterator iter = commands->begin();
43 ASSERT_TRUE(commands->end() != iter); 44 ASSERT_TRUE(commands->end() != iter);
44 const Command* named_command = &(*iter).second; 45 const Command* named_command = &(*iter).second;
45 ASSERT_STREQ("feature1", named_command->command_name().c_str()); 46 ASSERT_STREQ("feature1", named_command->command_name().c_str());
46 ASSERT_STREQ("desc", UTF16ToASCII(named_command->description()).c_str()); 47 ASSERT_STREQ("desc",
48 base::UTF16ToASCII(named_command->description()).c_str());
47 ASSERT_EQ(ctrl_shift_f, named_command->accelerator()); 49 ASSERT_EQ(ctrl_shift_f, named_command->accelerator());
48 50
49 const Command* browser_action = 51 const Command* browser_action =
50 CommandsInfo::GetBrowserActionCommand(extension.get()); 52 CommandsInfo::GetBrowserActionCommand(extension.get());
51 ASSERT_TRUE(NULL != browser_action); 53 ASSERT_TRUE(NULL != browser_action);
52 ASSERT_STREQ("_execute_browser_action", 54 ASSERT_STREQ("_execute_browser_action",
53 browser_action->command_name().c_str()); 55 browser_action->command_name().c_str());
54 ASSERT_STREQ("", UTF16ToASCII(browser_action->description()).c_str()); 56 ASSERT_STREQ("", base::UTF16ToASCII(browser_action->description()).c_str());
55 ASSERT_EQ(alt_shift_f, browser_action->accelerator()); 57 ASSERT_EQ(alt_shift_f, browser_action->accelerator());
56 58
57 const Command* page_action = 59 const Command* page_action =
58 CommandsInfo::GetPageActionCommand(extension.get()); 60 CommandsInfo::GetPageActionCommand(extension.get());
59 ASSERT_TRUE(NULL != page_action); 61 ASSERT_TRUE(NULL != page_action);
60 ASSERT_STREQ("_execute_page_action", 62 ASSERT_STREQ("_execute_page_action",
61 page_action->command_name().c_str()); 63 page_action->command_name().c_str());
62 ASSERT_STREQ("", UTF16ToASCII(page_action->description()).c_str()); 64 ASSERT_STREQ("", base::UTF16ToASCII(page_action->description()).c_str());
63 ASSERT_EQ(ctrl_f, page_action->accelerator()); 65 ASSERT_EQ(ctrl_f, page_action->accelerator());
64 } 66 }
65 67
66 TEST_F(CommandsManifestTest, CommandManifestShortcutsTooMany) { 68 TEST_F(CommandsManifestTest, CommandManifestShortcutsTooMany) {
67 LoadAndExpectError("command_too_many.json", 69 LoadAndExpectError("command_too_many.json",
68 errors::kInvalidKeyBindingTooMany); 70 errors::kInvalidKeyBindingTooMany);
69 } 71 }
70 72
71 TEST_F(CommandsManifestTest, CommandManifestManyButWithinBounds) { 73 TEST_F(CommandsManifestTest, CommandManifestManyButWithinBounds) {
72 scoped_refptr<Extension> extension = 74 scoped_refptr<Extension> extension =
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 LoadAndExpectSuccess("command_app_global.json"); 133 LoadAndExpectSuccess("command_app_global.json");
132 } 134 }
133 } 135 }
134 136
135 TEST_F(CommandsManifestTest, CommandManifestShouldNotCountMediaKeys) { 137 TEST_F(CommandsManifestTest, CommandManifestShouldNotCountMediaKeys) {
136 scoped_refptr<Extension> extension = 138 scoped_refptr<Extension> extension =
137 LoadAndExpectSuccess("command_should_not_count_media_keys.json"); 139 LoadAndExpectSuccess("command_should_not_count_media_keys.json");
138 } 140 }
139 141
140 } // namespace extensions 142 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/custom_handlers/protocol_handler.cc ('k') | chrome/common/extensions/command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698