| 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 <memory> |
| 5 #include <utility> | 6 #include <utility> |
| 6 | 7 |
| 7 #include "chrome/common/extensions/api/extension_action/action_info.h" | 8 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 8 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 9 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 9 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| 10 #include "extensions/common/error_utils.h" | 11 #include "extensions/common/error_utils.h" |
| 11 #include "extensions/common/extension_builder.h" | 12 #include "extensions/common/extension_builder.h" |
| 12 #include "extensions/common/extension_icon_set.h" | 13 #include "extensions/common/extension_icon_set.h" |
| 13 #include "extensions/common/manifest_constants.h" | 14 #include "extensions/common/manifest_constants.h" |
| 14 #include "extensions/common/value_builder.h" | 15 #include "extensions/common/value_builder.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // 24px icon should be included. | 106 // 24px icon should be included. |
| 106 EXPECT_EQ(3u, icons.map().size()); | 107 EXPECT_EQ(3u, icons.map().size()); |
| 107 EXPECT_EQ("icon19.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); | 108 EXPECT_EQ("icon19.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); |
| 108 EXPECT_EQ("icon24.png", icons.Get(24, ExtensionIconSet::MATCH_EXACTLY)); | 109 EXPECT_EQ("icon24.png", icons.Get(24, ExtensionIconSet::MATCH_EXACTLY)); |
| 109 EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); | 110 EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); |
| 110 } | 111 } |
| 111 | 112 |
| 112 TEST_F(BrowserActionManifestTest, | 113 TEST_F(BrowserActionManifestTest, |
| 113 BrowserActionManifestIcons_InvalidDefaultIcon) { | 114 BrowserActionManifestIcons_InvalidDefaultIcon) { |
| 114 scoped_ptr<base::DictionaryValue> manifest_value = | 115 std::unique_ptr<base::DictionaryValue> manifest_value = |
| 115 DictionaryBuilder() | 116 DictionaryBuilder() |
| 116 .Set("name", "Invalid default icon") | 117 .Set("name", "Invalid default icon") |
| 117 .Set("version", "1.0.0") | 118 .Set("version", "1.0.0") |
| 118 .Set("manifest_version", 2) | 119 .Set("manifest_version", 2) |
| 119 .Set("browser_action", | 120 .Set("browser_action", |
| 120 DictionaryBuilder() | 121 DictionaryBuilder() |
| 121 .Set("default_icon", | 122 .Set("default_icon", |
| 122 DictionaryBuilder() | 123 DictionaryBuilder() |
| 123 .Set("19", std::string()) // Invalid value. | 124 .Set("19", std::string()) // Invalid value. |
| 124 .Set("24", "icon24.png") | 125 .Set("24", "icon24.png") |
| 125 .Set("38", "icon38.png") | 126 .Set("38", "icon38.png") |
| 126 .Build()) | 127 .Build()) |
| 127 .Build()) | 128 .Build()) |
| 128 .Build(); | 129 .Build(); |
| 129 | 130 |
| 130 base::string16 error = ErrorUtils::FormatErrorMessageUTF16( | 131 base::string16 error = ErrorUtils::FormatErrorMessageUTF16( |
| 131 errors::kInvalidIconPath, "19"); | 132 errors::kInvalidIconPath, "19"); |
| 132 LoadAndExpectError( | 133 LoadAndExpectError( |
| 133 ManifestData(std::move(manifest_value), "Invalid default icon"), | 134 ManifestData(std::move(manifest_value), "Invalid default icon"), |
| 134 errors::kInvalidIconPath); | 135 errors::kInvalidIconPath); |
| 135 } | 136 } |
| 136 | 137 |
| 137 } // namespace | 138 } // namespace |
| 138 } // namespace extensions | 139 } // namespace extensions |
| OLD | NEW |