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

Side by Side Diff: chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/api/extension_action/action_info.h" 5 #include "chrome/common/extensions/api/extension_action/action_info.h"
6 #include "chrome/common/extensions/api/extension_action/script_badge_handler.h"
7 #include "chrome/common/extensions/extension_builder.h" 6 #include "chrome/common/extensions/extension_builder.h"
8 #include "chrome/common/extensions/extension_constants.h" 7 #include "chrome/common/extensions/extension_constants.h"
9 #include "chrome/common/extensions/extension_icon_set.h" 8 #include "chrome/common/extensions/extension_icon_set.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 9 #include "chrome/common/extensions/extension_manifest_constants.h"
11 #include "chrome/common/extensions/feature_switch.h" 10 #include "chrome/common/extensions/feature_switch.h"
12 #include "chrome/common/extensions/manifest_handlers/icons_handler.h"
13 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 11 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
14 #include "extensions/common/install_warning.h" 12 #include "extensions/common/install_warning.h"
15 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
17 15
18 namespace errors = extension_manifest_errors; 16 namespace errors = extension_manifest_errors;
19 17
20 namespace extensions { 18 namespace extensions {
21 19
22 namespace { 20 namespace {
23 21
24 std::vector<InstallWarning> StripMissingFlagWarning( 22 std::vector<InstallWarning> StripMissingFlagWarning(
25 const std::vector<InstallWarning>& install_warnings) { 23 const std::vector<InstallWarning>& install_warnings) {
26 std::vector<InstallWarning> result; 24 std::vector<InstallWarning> result;
27 for (size_t i = 0; i < install_warnings.size(); ++i) { 25 for (size_t i = 0; i < install_warnings.size(); ++i) {
28 if (install_warnings[i].message != errors::kScriptBadgeRequiresFlag) 26 if (install_warnings[i].message != errors::kScriptBadgeRequiresFlag)
29 result.push_back(install_warnings[i]); 27 result.push_back(install_warnings[i]);
30 } 28 }
31 return result; 29 return result;
32 } 30 }
33 31
34 class ScriptBadgeManifestTest : public ExtensionManifestTest { 32 class ScriptBadgeManifestTest : public ExtensionManifestTest {
35 protected:
36 virtual void SetUp() OVERRIDE {
37 (new IconsHandler)->Register();
38 (new ScriptBadgeHandler)->Register();
39 }
40 }; 33 };
41 34
42 } // namespace 35 } // namespace
43 36
44 TEST_F(ScriptBadgeManifestTest, ScriptBadgeBasic) { 37 TEST_F(ScriptBadgeManifestTest, ScriptBadgeBasic) {
45 scoped_refptr<Extension> extension( 38 scoped_refptr<Extension> extension(
46 ExtensionBuilder() 39 ExtensionBuilder()
47 .SetManifest(DictionaryBuilder() 40 .SetManifest(DictionaryBuilder()
48 .Set("manifest_version", 2) 41 .Set("manifest_version", 2)
49 .Set("name", "my extension") 42 .Set("name", "my extension")
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 EXPECT_EQ(2u, default_icon.map().size()); 140 EXPECT_EQ(2u, default_icon.map().size());
148 EXPECT_EQ("icon128.png", 141 EXPECT_EQ("icon128.png",
149 default_icon.Get(extension_misc::EXTENSION_ICON_BITTY, 142 default_icon.Get(extension_misc::EXTENSION_ICON_BITTY,
150 ExtensionIconSet::MATCH_EXACTLY)); 143 ExtensionIconSet::MATCH_EXACTLY));
151 EXPECT_EQ("icon128.png", 144 EXPECT_EQ("icon128.png",
152 default_icon.Get(2 * extension_misc::EXTENSION_ICON_BITTY, 145 default_icon.Get(2 * extension_misc::EXTENSION_ICON_BITTY,
153 ExtensionIconSet::MATCH_EXACTLY)); 146 ExtensionIconSet::MATCH_EXACTLY));
154 } 147 }
155 148
156 } // namespace extensions 149 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698