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

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

Issue 10905005: Change browser/page action default icon defined in manifest to support hidpi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forgot to update tests Created 8 years, 3 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/extension_action.h"
6 #include "chrome/common/extensions/extension_error_utils.h"
7 #include "chrome/common/extensions/extension_icon_set.h"
8 #include "chrome/common/extensions/extension_manifest_constants.h"
9 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace errors = extension_manifest_errors;
13
14 TEST_F(ExtensionManifestTest, BrowserActionManifestIcons) {
15 {
Jeffrey Yasskin 2012/09/17 20:18:39 Make each of these blocks its own TEST_F. That giv
tbarzic 2012/09/17 22:06:10 Done.
16 scoped_refptr<extensions::Extension> extension(
17 LoadAndExpectSuccess("browser_action_no_default_properties.json"));
Jeffrey Yasskin 2012/09/17 20:18:39 Instead of storing the json you want to load separ
tbarzic 2012/09/17 22:06:10 Done.
18 ASSERT_TRUE(extension.get());
19 ASSERT_TRUE(extension->browser_action());
20 EXPECT_FALSE(extension->browser_action()->default_icon());
21 }
22
23 {
24 scoped_refptr<extensions::Extension> extension(
25 LoadAndExpectSuccess("browser_action_with_string_default_icon.json"));
26 ASSERT_TRUE(extension.get());
27 ASSERT_TRUE(extension->browser_action());
28 ASSERT_TRUE(extension->browser_action()->default_icon());
29
30 const ExtensionIconSet* icons = extension->browser_action()->default_icon();
31
32 EXPECT_EQ(1u, icons->map().size());
33 EXPECT_EQ("icon.png", icons->Get(19, ExtensionIconSet::MATCH_EXACTLY));
34 }
35
36 {
37 scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess(
38 "browser_action_with_dictionary_default_icon.json"));
39 ASSERT_TRUE(extension.get());
40 ASSERT_TRUE(extension->browser_action());
41 ASSERT_TRUE(extension->browser_action()->default_icon());
42
43 const ExtensionIconSet* icons = extension->browser_action()->default_icon();
44
45 EXPECT_EQ(2u, icons->map().size());
46 EXPECT_EQ("icon19.png", icons->Get(19, ExtensionIconSet::MATCH_EXACTLY));
47 EXPECT_EQ("icon38.png", icons->Get(38, ExtensionIconSet::MATCH_EXACTLY));
Jeffrey Yasskin 2012/09/17 20:18:39 Please comment that you're testing that the 24px i
tbarzic 2012/09/17 22:06:10 Done.
48 }
49
50 {
51 string16 error = ExtensionErrorUtils::FormatErrorMessageUTF16(
52 errors::kInvalidIconPath, "19");
53 LoadAndExpectError("browser_action_invalid_default_icons.json",
54 errors::kInvalidIconPath);
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698