aboutsummaryrefslogtreecommitdiff
path: root/src/common/simple_string_dictionary_unittest.cc
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-05-08 16:06:33 +0000
committerrsesek@chromium.org <rsesek@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2013-05-08 16:06:33 +0000
commitdf6f45b04bbf304b009ec69334e7079b27e83bec (patch)
treee1d21f12dd626f48ce3e47b0280618817eb26e07 /src/common/simple_string_dictionary_unittest.cc
parentMake x86-64 stack walking work for Native Client minidumps (diff)
downloadbreakpad-df6f45b04bbf304b009ec69334e7079b27e83bec.tar.xz
NULL-check the entry in NonAllocatingMap before setting on it.
Using just an assert will still cause a crash in a release build. BUG=http://code.google.com/p/chromium/issues/detail?id=238757 R=mark@chromium.org Review URL: https://breakpad.appspot.com/593003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1174 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/simple_string_dictionary_unittest.cc')
-rw-r--r--src/common/simple_string_dictionary_unittest.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/common/simple_string_dictionary_unittest.cc b/src/common/simple_string_dictionary_unittest.cc
index ec05cfaa..5fbc481c 100644
--- a/src/common/simple_string_dictionary_unittest.cc
+++ b/src/common/simple_string_dictionary_unittest.cc
@@ -278,15 +278,18 @@ TEST(NonAllocatingMapTest, Serialize) {
EXPECT_STREQ("hig", deserialized.GetValueForKey("tre"));
}
-#ifndef NDEBUG
-
+// Running out of space shouldn't crash.
TEST(NonAllocatingMapTest, OutOfSpace) {
NonAllocatingMap<3, 2, 2> map;
map.SetKeyValue("a", "1");
map.SetKeyValue("b", "2");
- ASSERT_DEATH(map.SetKeyValue("c", "3"), "");
+ map.SetKeyValue("c", "3");
+ EXPECT_EQ(2u, map.GetCount());
+ EXPECT_FALSE(map.GetValueForKey("c"));
}
+#ifndef NDEBUG
+
TEST(NonAllocatingMapTest, KeyTooLong) {
NonAllocatingMap<3, 10, 12> map;
map.SetKeyValue("ab", "cdefghi");