| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 evicted_normal_location->Seek("key1"); | 243 evicted_normal_location->Seek("key1"); |
| 244 evicted_before_start->Seek("key1"); | 244 evicted_before_start->Seek("key1"); |
| 245 evicted_before_start->Prev(); | 245 evicted_before_start->Prev(); |
| 246 evicted_after_end->SeekToLast(); | 246 evicted_after_end->SeekToLast(); |
| 247 evicted_after_end->Next(); | 247 evicted_after_end->Next(); |
| 248 | 248 |
| 249 // Nothing is purged, as we just have 3 iterators used. | 249 // Nothing is purged, as we just have 3 iterators used. |
| 250 EXPECT_FALSE(evicted_normal_location->IsDetached()); | 250 EXPECT_FALSE(evicted_normal_location->IsDetached()); |
| 251 EXPECT_FALSE(evicted_before_start->IsDetached()); | 251 EXPECT_FALSE(evicted_before_start->IsDetached()); |
| 252 EXPECT_FALSE(evicted_after_end->IsDetached()); | 252 EXPECT_FALSE(evicted_after_end->IsDetached()); |
| 253 EXPECT_FALSE(evicted_before_start->IsValid()); | |
| 254 EXPECT_FALSE(evicted_after_end->IsValid()); | |
| 255 | 253 |
| 256 // Should purge all of our earlier iterators. | 254 // Should purge all of our earlier iterators. |
| 257 it1->Seek("key1"); | 255 it1->Seek("key1"); |
| 258 it2->Seek("key2"); | 256 it2->Seek("key2"); |
| 259 it3->Seek("key3"); | 257 it3->Seek("key3"); |
| 260 | 258 |
| 261 EXPECT_TRUE(evicted_normal_location->IsDetached()); | 259 EXPECT_TRUE(evicted_normal_location->IsDetached()); |
| 262 EXPECT_TRUE(evicted_before_start->IsDetached()); | 260 EXPECT_TRUE(evicted_before_start->IsDetached()); |
| 263 EXPECT_TRUE(evicted_after_end->IsDetached()); | 261 EXPECT_TRUE(evicted_after_end->IsDetached()); |
| 264 | 262 |
| 263 EXPECT_FALSE(evicted_before_start->IsValid()); |
| 264 EXPECT_TRUE(evicted_normal_location->IsValid()); |
| 265 EXPECT_FALSE(evicted_after_end->IsValid()); |
| 266 |
| 265 // Check we don't need to reload for just the key. | 267 // Check we don't need to reload for just the key. |
| 266 EXPECT_EQ("key1", evicted_normal_location->Key()); | 268 EXPECT_EQ("key1", evicted_normal_location->Key()); |
| 267 EXPECT_TRUE(evicted_normal_location->IsDetached()); | 269 EXPECT_TRUE(evicted_normal_location->IsDetached()); |
| 268 | 270 |
| 269 // Make sure iterators are reloaded correctly. | 271 // Make sure iterators are reloaded correctly. |
| 270 EXPECT_TRUE(evicted_normal_location->IsValid()); | 272 EXPECT_TRUE(evicted_normal_location->IsValid()); |
| 271 EXPECT_EQ("value1", evicted_normal_location->Value()); | 273 EXPECT_EQ("value1", evicted_normal_location->Value()); |
| 272 EXPECT_FALSE(evicted_normal_location->IsDetached()); | 274 EXPECT_FALSE(evicted_normal_location->IsDetached()); |
| 273 EXPECT_FALSE(evicted_before_start->IsValid()); | 275 EXPECT_FALSE(evicted_before_start->IsValid()); |
| 274 EXPECT_FALSE(evicted_after_end->IsValid()); | 276 EXPECT_FALSE(evicted_after_end->IsValid()); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 EXPECT_EQ(Compare(key_after_range_, it->Key()), 0); | 423 EXPECT_EQ(Compare(key_after_range_, it->Key()), 0); |
| 422 } | 424 } |
| 423 | 425 |
| 424 INSTANTIATE_TEST_CASE_P(LevelDBTransactionRangeTests, | 426 INSTANTIATE_TEST_CASE_P(LevelDBTransactionRangeTests, |
| 425 LevelDBTransactionRangeTest, | 427 LevelDBTransactionRangeTest, |
| 426 ::testing::Values(DataInMemory, | 428 ::testing::Values(DataInMemory, |
| 427 DataInDatabase, | 429 DataInDatabase, |
| 428 DataMixed)); | 430 DataMixed)); |
| 429 | 431 |
| 430 } // namespace content | 432 } // namespace content |
| OLD | NEW |