OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "client/simple_string_dictionary.h" | 15 #include "client/simple_string_dictionary.h" |
16 | 16 |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "gtest/gtest.h" | 18 #include "gtest/gtest.h" |
| 19 #include "util/test/gtest_death_check.h" |
19 | 20 |
20 namespace crashpad { | 21 namespace crashpad { |
21 namespace test { | 22 namespace test { |
22 namespace { | 23 namespace { |
23 | 24 |
24 TEST(SimpleStringDictionary, Entry) { | 25 TEST(SimpleStringDictionary, Entry) { |
25 using TestMap = TSimpleStringDictionary<5, 9, 15>; | 26 using TestMap = TSimpleStringDictionary<5, 9, 15>; |
26 TestMap map; | 27 TestMap map; |
27 | 28 |
28 const TestMap::Entry* entry = TestMap::Iterator(map).Next(); | 29 const TestMap::Entry* entry = TestMap::Iterator(map).Next(); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 map.SetKeyValue("b", "2"); | 273 map.SetKeyValue("b", "2"); |
273 map.SetKeyValue("c", "3"); | 274 map.SetKeyValue("c", "3"); |
274 EXPECT_EQ(2u, map.GetCount()); | 275 EXPECT_EQ(2u, map.GetCount()); |
275 EXPECT_FALSE(map.GetValueForKey("c")); | 276 EXPECT_FALSE(map.GetValueForKey("c")); |
276 } | 277 } |
277 | 278 |
278 #if DCHECK_IS_ON | 279 #if DCHECK_IS_ON |
279 | 280 |
280 TEST(SimpleStringDictionaryDeathTest, NullKey) { | 281 TEST(SimpleStringDictionaryDeathTest, NullKey) { |
281 TSimpleStringDictionary<4, 6, 6> map; | 282 TSimpleStringDictionary<4, 6, 6> map; |
282 ASSERT_DEATH(map.SetKeyValue(nullptr, "hello"), "key"); | 283 ASSERT_DEATH_CHECK(map.SetKeyValue(nullptr, "hello"), "key"); |
283 | 284 |
284 map.SetKeyValue("hi", "there"); | 285 map.SetKeyValue("hi", "there"); |
285 ASSERT_DEATH(map.GetValueForKey(nullptr), "key"); | 286 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); |
286 EXPECT_STREQ("there", map.GetValueForKey("hi")); | 287 EXPECT_STREQ("there", map.GetValueForKey("hi")); |
287 | 288 |
288 ASSERT_DEATH(map.GetValueForKey(nullptr), "key"); | 289 ASSERT_DEATH_CHECK(map.GetValueForKey(nullptr), "key"); |
289 map.RemoveKey("hi"); | 290 map.RemoveKey("hi"); |
290 EXPECT_EQ(0u, map.GetCount()); | 291 EXPECT_EQ(0u, map.GetCount()); |
291 } | 292 } |
292 | 293 |
293 #endif | 294 #endif |
294 | 295 |
295 } // namespace | 296 } // namespace |
296 } // namespace test | 297 } // namespace test |
297 } // namespace crashpad | 298 } // namespace crashpad |
OLD | NEW |