mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-29 08:39:44 +08:00
Workaround for death test failure when in threadsafe mode on Mac.
Google Test has recently switched the default death test style from "fast" to "threadsafe". This is a better default, and Chrome will adopt it on all platforms except for Android. In threadsafe mode, the death test in client/simple_string_dictionary_test.cc consistently crashes with the wrong expectation on Mac. Fortunately, breaking the test up into two smaller tests makes the failures go away, and also adds a bit of clarity into what is being tested. Bug: crashpad:221 Change-Id: I2416647948815cfe46a003da8209af8b7278de2a Reviewed-on: https://chromium-review.googlesource.com/936043 Commit-Queue: Victor Costan <pwnall@chromium.org> Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
fae18c2fc4
commit
a869ae18d2
@ -253,21 +253,30 @@ TEST(SimpleStringDictionary, OutOfSpace) {
|
|||||||
|
|
||||||
#if DCHECK_IS_ON()
|
#if DCHECK_IS_ON()
|
||||||
|
|
||||||
TEST(SimpleStringDictionaryDeathTest, NullKey) {
|
TEST(SimpleStringDictionaryDeathTest, SetKeyValueWithNullKey) {
|
||||||
TSimpleStringDictionary<4, 6, 6> map;
|
TSimpleStringDictionary<4, 6, 6> map;
|
||||||
ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key");
|
ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(SimpleStringDictionaryDeathTest, GetValueForKeyWithNullKey) {
|
||||||
|
TSimpleStringDictionary<4, 6, 6> map;
|
||||||
map.SetKeyValue("hi", "there");
|
map.SetKeyValue("hi", "there");
|
||||||
ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
|
ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
|
||||||
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
||||||
|
|
||||||
ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
|
|
||||||
map.RemoveKey("hi");
|
|
||||||
EXPECT_EQ(map.GetCount(), 0u);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// The tests above, without DEATH_CHECK assertions.
|
||||||
|
TEST(SimpleStringDictionaryDeathTest, GetValueForKeyWithoutNullKey) {
|
||||||
|
TSimpleStringDictionary<4, 6, 6> map;
|
||||||
|
|
||||||
|
map.SetKeyValue("hi", "there");
|
||||||
|
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
||||||
|
map.RemoveKey("hi");
|
||||||
|
EXPECT_EQ(map.GetCount(), 0u);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
Loading…
x
Reference in New Issue
Block a user