| OLD | NEW |
| 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/manifest_tests/extension_manifest_test.h" | 6 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 7 #include "extensions/common/error_utils.h" | 7 #include "extensions/common/error_utils.h" |
| 8 #include "extensions/common/extension_builder.h" | 8 #include "extensions/common/extension_builder.h" |
| 9 #include "extensions/common/extension_icon_set.h" | 9 #include "extensions/common/extension_icon_set.h" |
| 10 #include "extensions/common/manifest_constants.h" | 10 #include "extensions/common/manifest_constants.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 ASSERT_TRUE(extension.get()); | 54 ASSERT_TRUE(extension.get()); |
| 55 const ActionInfo* browser_action_info = | 55 const ActionInfo* browser_action_info = |
| 56 ActionInfo::GetBrowserActionInfo(extension.get()); | 56 ActionInfo::GetBrowserActionInfo(extension.get()); |
| 57 ASSERT_TRUE(browser_action_info); | 57 ASSERT_TRUE(browser_action_info); |
| 58 ASSERT_FALSE(browser_action_info->default_icon.empty()); | 58 ASSERT_FALSE(browser_action_info->default_icon.empty()); |
| 59 | 59 |
| 60 const ExtensionIconSet& icons = browser_action_info->default_icon; | 60 const ExtensionIconSet& icons = browser_action_info->default_icon; |
| 61 | 61 |
| 62 EXPECT_EQ(1u, icons.map().size()); | 62 EXPECT_EQ(1u, icons.map().size()); |
| 63 EXPECT_EQ("icon.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); | 63 EXPECT_EQ("icon.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST_F(BrowserActionManifestTest, | 66 TEST_F(BrowserActionManifestTest, |
| 67 BrowserActionManifestIcons_DictDefaultIcon) { | 67 BrowserActionManifestIcons_DictDefaultIcon) { |
| 68 scoped_refptr<const Extension> extension = | 68 scoped_refptr<const Extension> extension = |
| 69 ExtensionBuilder() | 69 ExtensionBuilder() |
| 70 .SetManifest(DictionaryBuilder() | 70 .SetManifest(DictionaryBuilder() |
| 71 .Set("name", "Dictionary default icon") | 71 .Set("name", "Dictionary default icon") |
| 72 .Set("version", "1.0.0") | 72 .Set("version", "1.0.0") |
| 73 .Set("manifest_version", 2) | 73 .Set("manifest_version", 2) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 .Set("24", "icon24.png").Set("38", "icon38.png"))).Build(); | 104 .Set("24", "icon24.png").Set("38", "icon38.png"))).Build(); |
| 105 | 105 |
| 106 base::string16 error = ErrorUtils::FormatErrorMessageUTF16( | 106 base::string16 error = ErrorUtils::FormatErrorMessageUTF16( |
| 107 errors::kInvalidIconPath, "19"); | 107 errors::kInvalidIconPath, "19"); |
| 108 LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"), | 108 LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"), |
| 109 errors::kInvalidIconPath); | 109 errors::kInvalidIconPath); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace | 112 } // namespace |
| 113 } // namespace extensions | 113 } // namespace extensions |
| OLD | NEW |