mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-27 23:41:02 +08:00
Don't implicitly construct StringPiece from nullptr
This change implements the crashpad changes from https://crrev.com/c/2027791 upstream. Bug: chromium:1049498 Change-Id: I59b920d878b080d41db32bf0305d3d8f3d4f47c9 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2042712 Commit-Queue: Mark Mentovai <mark@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
5779e638e1
commit
52ddeac77c
@ -73,7 +73,7 @@ TEST(SimpleStringDictionary, SimpleStringDictionary) {
|
||||
EXPECT_FALSE(dict.GetValueForKey("key3"));
|
||||
|
||||
// Remove by setting value to nullptr
|
||||
dict.SetKeyValue("key2", nullptr);
|
||||
dict.SetKeyValue("key2", base::StringPiece(nullptr, 0));
|
||||
|
||||
// Now make sure it's not there anymore
|
||||
EXPECT_FALSE(dict.GetValueForKey("key2"));
|
||||
@ -254,13 +254,14 @@ TEST(SimpleStringDictionary, OutOfSpace) {
|
||||
|
||||
TEST(SimpleStringDictionaryDeathTest, SetKeyValueWithNullKey) {
|
||||
TSimpleStringDictionary<4, 6, 6> map;
|
||||
ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key");
|
||||
ASSERT_DEATH_CHECK(map.SetKeyValue(base::StringPiece(nullptr, 0), "hello"),
|
||||
"key");
|
||||
}
|
||||
|
||||
TEST(SimpleStringDictionaryDeathTest, GetValueForKeyWithNullKey) {
|
||||
TSimpleStringDictionary<4, 6, 6> map;
|
||||
map.SetKeyValue("hi", "there");
|
||||
ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key");
|
||||
ASSERT_DEATH_CHECK(map.GetValueForKey(base::StringPiece(nullptr, 0)), "key");
|
||||
EXPECT_STREQ("there", map.GetValueForKey("hi"));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user