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

Side by Side Diff: chrome/common/extensions/api/icons/icons_manifest_unittest.cc

Issue 13460012: Move IconsHandler from c/c/e/api/ to c/c/e (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for CQ Created 7 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 "base/memory/linked_ptr.h"
8 #include "chrome/common/extensions/api/icons/icons_handler.h"
9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/common/extensions/extension_constants.h"
11 #include "chrome/common/extensions/extension_icon_set.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace extensions {
15
16 class IconsManifestTest : public ExtensionManifestTest {
17 protected:
18 virtual void SetUp() OVERRIDE {
19 ExtensionManifestTest::SetUp();
20 (new IconsHandler)->Register();
21 }
22 };
23
24 TEST_F(IconsManifestTest, NormalizeIconPaths) {
25 scoped_refptr<extensions::Extension> extension(
26 LoadAndExpectSuccess("normalize_icon_paths.json"));
27 const ExtensionIconSet& icons = IconsInfo::GetIcons(extension);
28
29 EXPECT_EQ("16.png", icons.Get(extension_misc::EXTENSION_ICON_BITTY,
30 ExtensionIconSet::MATCH_EXACTLY));
31 EXPECT_EQ("48.png", icons.Get(extension_misc::EXTENSION_ICON_MEDIUM,
32 ExtensionIconSet::MATCH_EXACTLY));
33 }
34
35 TEST_F(IconsManifestTest, InvalidIconSizes) {
36 scoped_refptr<extensions::Extension> extension(
37 LoadAndExpectSuccess("init_ignored_icon_size.json"));
38 EXPECT_EQ("", IconsInfo::GetIcons(extension).Get(
39 300, ExtensionIconSet::MATCH_EXACTLY));
40 }
41
42 TEST_F(IconsManifestTest, ValidIconSizes) {
43 scoped_refptr<extensions::Extension> extension(
44 LoadAndExpectSuccess("init_valid_icon_size.json"));
45 const ExtensionIconSet& icons = IconsInfo::GetIcons(extension);
46
47 EXPECT_EQ("16.png", icons.Get(extension_misc::EXTENSION_ICON_BITTY,
48 ExtensionIconSet::MATCH_EXACTLY));
49 EXPECT_EQ("24.png", icons.Get(extension_misc::EXTENSION_ICON_SMALLISH,
50 ExtensionIconSet::MATCH_EXACTLY));
51 EXPECT_EQ("32.png", icons.Get(extension_misc::EXTENSION_ICON_SMALL,
52 ExtensionIconSet::MATCH_EXACTLY));
53 EXPECT_EQ("48.png", icons.Get(extension_misc::EXTENSION_ICON_MEDIUM,
54 ExtensionIconSet::MATCH_EXACTLY));
55 EXPECT_EQ("128.png", icons.Get(extension_misc::EXTENSION_ICON_LARGE,
56 ExtensionIconSet::MATCH_EXACTLY));
57 EXPECT_EQ("256.png", icons.Get(extension_misc::EXTENSION_ICON_EXTRA_LARGE,
58 ExtensionIconSet::MATCH_EXACTLY));
59 EXPECT_EQ("512.png", icons.Get(extension_misc::EXTENSION_ICON_GIGANTOR,
60 ExtensionIconSet::MATCH_EXACTLY));
61 }
62
63 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/icons/icons_handler.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698