Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Unified Diff: chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc

Issue 426063008: [SyncFS] Fix a bug in LevelDBWrapper::Iterator::Next (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc
index c77a049b0023b675b8f71386eb30928cdb1dfe22..8c6bed8e1e6f7d11960d2bbeb26f670a776a9ecd 100644
--- a/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/leveldb_wrapper_unittest.cc
@@ -115,6 +115,29 @@ TEST_F(LevelDBWrapperTest, IteratorTest) {
EXPECT_FALSE(itr->Valid());
}
+TEST_F(LevelDBWrapperTest, Iterator2Test) {
+ GetDB()->Put("a", "1");
+ GetDB()->Put("b", "2");
+ GetDB()->Put("c", "3");
+ // Keep pending transanctions on memory.
+
+ scoped_ptr<LevelDBWrapper::Iterator> itr = GetDB()->NewIterator();
+
+ std::string prev_key;
+ std::string prev_value;
+ int loop_counter = 0;
+ for (itr->SeekToFirst(); itr->Valid(); itr->Next()) {
+ ASSERT_NE(prev_key, itr->key().ToString());
+ ASSERT_NE(prev_value, itr->value().ToString());
+ prev_key = itr->key().ToString();
+ prev_value = itr->value().ToString();
+ ++loop_counter;
+ }
+ EXPECT_EQ(3, loop_counter);
+ EXPECT_EQ("c", prev_key);
+ EXPECT_EQ("3", prev_value);
+}
+
TEST_F(LevelDBWrapperTest, PutTest) {
TestData merged_data[] = {{"a", "1"}, {"aa", "new0"}, {"ab", "0"},
{"bb", "new2"}, {"c", "new1"}, {"d", "4"}};
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/leveldb_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698