| 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/api/extension_action/browser_action_handler.h
" | 6 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h
" |
| 7 #include "chrome/common/extensions/extension_builder.h" | 7 #include "chrome/common/extensions/extension_builder.h" |
| 8 #include "chrome/common/extensions/extension_icon_set.h" | 8 #include "chrome/common/extensions/extension_icon_set.h" |
| 9 #include "chrome/common/extensions/extension_manifest_constants.h" | 9 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 10 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 // 24px icon should be ignored. | 94 // 24px icon should be ignored. |
| 95 EXPECT_EQ(2u, icons.map().size()); | 95 EXPECT_EQ(2u, icons.map().size()); |
| 96 EXPECT_EQ("icon19.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); | 96 EXPECT_EQ("icon19.png", icons.Get(19, ExtensionIconSet::MATCH_EXACTLY)); |
| 97 EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); | 97 EXPECT_EQ("icon38.png", icons.Get(38, ExtensionIconSet::MATCH_EXACTLY)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST_F(BrowserActionManifestTest, | 100 TEST_F(BrowserActionManifestTest, |
| 101 BrowserActionManifestIcons_InvalidDefaultIcon) { | 101 BrowserActionManifestIcons_InvalidDefaultIcon) { |
| 102 scoped_ptr<DictionaryValue> manifest_value = DictionaryBuilder() | 102 scoped_ptr<DictionaryValue> manifest_value = DictionaryBuilder() |
| 103 .Set("name", "Invalid default icon") | 103 .Set("name", "Invalid default icon").Set("version", "1.0.0") |
| 104 .Set("version", "1.0.0") | |
| 105 .Set("manifest_version", 2) | 104 .Set("manifest_version", 2) |
| 106 .Set("browser_action", DictionaryBuilder() | 105 .Set("browser_action", |
| 107 .Set("default_icon", DictionaryBuilder() | 106 DictionaryBuilder().Set( |
| 108 .Set("19", "") // Invalid value. | 107 "default_icon", |
| 109 .Set("24", "icon24.png") | 108 DictionaryBuilder().Set("19", std::string()) // Invalid value. |
| 110 .Set("38", "icon38.png"))) | 109 .Set("24", "icon24.png").Set("38", "icon38.png"))).Build(); |
| 111 .Build(); | |
| 112 | 110 |
| 113 string16 error = ErrorUtils::FormatErrorMessageUTF16( | 111 string16 error = ErrorUtils::FormatErrorMessageUTF16( |
| 114 errors::kInvalidIconPath, "19"); | 112 errors::kInvalidIconPath, "19"); |
| 115 LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"), | 113 LoadAndExpectError(Manifest(manifest_value.get(), "Invalid default icon"), |
| 116 errors::kInvalidIconPath); | 114 errors::kInvalidIconPath); |
| 117 } | 115 } |
| 118 | 116 |
| 119 } // namespace | 117 } // namespace |
| 120 } // namespace extensions | 118 } // namespace extensions |
| OLD | NEW |