diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-06 18:05:41 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-06 18:05:41 +0000 |
commit | 6e12377f0b289b14858149b8cfe33abac46a06f6 (patch) | |
tree | 5b944dd17db0749793d5ef7af90fe5c6d0255d90 /chrome/common/extensions | |
parent | 7ef4cbbb55e58e43e7edcf358a9fb689673d39a9 (diff) | |
download | chromium_src-6e12377f0b289b14858149b8cfe33abac46a06f6.zip chromium_src-6e12377f0b289b14858149b8cfe33abac46a06f6.tar.gz chromium_src-6e12377f0b289b14858149b8cfe33abac46a06f6.tar.bz2 |
Fix regression caused by r73784, add regression test and
do some minor test organization.
BUG=57263,71955
TEST=Install https://chrome.google.com/webstore/detail/odmpalfplhaahlgnkkonchfhpegdcgjm and a few apps from the web store. Open popup. Popup should contain icons for each app and should not crash.
Review URL: http://codereview.chromium.org/6410088
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r-- | chrome/common/extensions/extension_icon_set.cc | 10 | ||||
-rw-r--r-- | chrome/common/extensions/extension_icon_set_unittest.cc | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/chrome/common/extensions/extension_icon_set.cc b/chrome/common/extensions/extension_icon_set.cc index 1f1dd21..fc1ac58 100644 --- a/chrome/common/extensions/extension_icon_set.cc +++ b/chrome/common/extensions/extension_icon_set.cc @@ -15,7 +15,7 @@ void ExtensionIconSet::Clear() { } void ExtensionIconSet::Add(int size, const std::string& path) { - DCHECK(path.size() > 0 && path[0] != '/'); + CHECK(path.size() > 0 && path[0] != '/'); map_[size] = path; } @@ -50,10 +50,14 @@ std::string ExtensionIconSet::Get(int size, MatchType match_type) const { } bool ExtensionIconSet::ContainsPath(const std::string& path) const { - DCHECK(path.size() > 0 && path[0] != '/'); + if (path.empty()) + return false; + + CHECK(path[0] != '/') << + "ExtensionIconSet stores icon paths without leading slash."; + for (IconMap::const_iterator iter = map_.begin(); iter != map_.end(); ++iter) { - LOG(ERROR) << iter->second << " , " << path; if (iter->second == path) return true; } diff --git a/chrome/common/extensions/extension_icon_set_unittest.cc b/chrome/common/extensions/extension_icon_set_unittest.cc index 4da96bc..9bd1ec5 100644 --- a/chrome/common/extensions/extension_icon_set_unittest.cc +++ b/chrome/common/extensions/extension_icon_set_unittest.cc @@ -44,6 +44,7 @@ TEST(ExtensionIconSet, Values) { EXPECT_TRUE(icons.ContainsPath("foo")); EXPECT_TRUE(icons.ContainsPath("bar")); EXPECT_FALSE(icons.ContainsPath("baz")); + EXPECT_FALSE(icons.ContainsPath("")); icons.Clear(); EXPECT_FALSE(icons.ContainsPath("foo")); |