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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_scriptbadge_unittest.cc

Issue 10565017: Parse the script_badge manifest section. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6
7 #include "chrome/common/extensions/extension_action.h"
8 #include "chrome/common/extensions/extension_manifest_constants.h"
9 #include "chrome/common/extensions/extension_switch_utils.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
12
13 namespace errors = extension_manifest_errors;
14 namespace switch_utils = extensions::switch_utils;
15
16 TEST_F(ExtensionManifestTest, ScriptBadgeBasic) {
17 switch_utils::ScopedSetActionBoxForTest _(switch_utils::ENABLED);
18 scoped_refptr<extensions::Extension> extension(
19 LoadAndExpectSuccess("script_badge_basic.json"));
20 ASSERT_TRUE(extension.get());
21 ASSERT_TRUE(extension->script_badge());
22
23 EXPECT_EQ("Hello World", extension->script_badge()->GetTitle(
24 ExtensionAction::kDefaultTabId));
25 EXPECT_TRUE(extension->script_badge()->HasPopup(
26 ExtensionAction::kDefaultTabId));
27 EXPECT_TRUE(extension->script_badge()->GetIcon(
28 ExtensionAction::kDefaultTabId).isNull());
29 EXPECT_EQ("icon16.png", extension->script_badge()->default_icon_path());
30 }
31
32 TEST_F(ExtensionManifestTest, ScriptBadgeForbiddenWithoutActionBox) {
33 switch_utils::ScopedSetActionBoxForTest _(switch_utils::DISABLED);
34 LoadAndExpectError("script_badge_basic.json",
35 errors::kScriptBadgeRequiresActionBox);
36 }
37
38 TEST_F(ExtensionManifestTest, ScriptBadgeExplicitIconsForbidden) {
39 switch_utils::ScopedSetActionBoxForTest _(switch_utils::ENABLED);
40 LoadAndExpectError("script_badge_icons_forbidden.json",
41 errors::kScriptBadgeCannotSpecifyIcon);
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698