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

Unified Diff: sync/syncable/directory_backing_store_unittest.cc

Issue 11441026: [Sync] Add support for loading, updating and querying delete journals in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make IsDeleteJournalEnabled() public Created 8 years 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
Index: sync/syncable/directory_backing_store_unittest.cc
diff --git a/sync/syncable/directory_backing_store_unittest.cc b/sync/syncable/directory_backing_store_unittest.cc
index 1b89ae0cbf815e65392b03a6e6fa6b799a108d26..7969fe8a2f6371977d50ca1d83930b32eeb2e7a6 100644
--- a/sync/syncable/directory_backing_store_unittest.cc
+++ b/sync/syncable/directory_backing_store_unittest.cc
@@ -46,9 +46,10 @@ class MigrationTest : public testing::TestWithParam<int> {
static bool LoadAndIgnoreReturnedData(DirectoryBackingStore *dbs) {
MetahandlesIndex metas;
+ JournalIndex delete_journals;;
STLElementDeleter<MetahandlesIndex> index_deleter(&metas);
Directory::KernelLoadInfo kernel_load_info;
- return dbs->Load(&metas, &kernel_load_info) == OPENED;
+ return dbs->Load(&metas, &delete_journals, &kernel_load_info) == OPENED;
}
void SetUpVersion67Database(sql::Connection* connection);
@@ -2216,8 +2217,8 @@ void MigrationTest::SetUpVersion84Database(sql::Connection* connection) {
"server_is_del bit default 0,non_unique_name varchar,server_non_uniqu"
"e_name varchar(255),unique_server_tag varchar,unique_client_tag varc"
"har,specifics blob,server_specifics blob, base_server_specifics BLOB"
- ", server_ordinal_in_parent blob, transaction_verion bigint default 0"
- ");"
+ ", server_ordinal_in_parent blob, transaction_version bigint default "
+ "0);"
"CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda"
"y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defa"
"ult -2, cache_guid TEXT , notification_state BLOB, bag_of_chips "
@@ -2338,8 +2339,8 @@ void MigrationTest::SetUpVersion85Database(sql::Connection* connection) {
"server_is_del bit default 0,non_unique_name varchar,server_non_uniqu"
"e_name varchar(255),unique_server_tag varchar,unique_client_tag varc"
"har,specifics blob,server_specifics blob, base_server_specifics BLOB"
- ", server_ordinal_in_parent blob, transaction_verion bigint default 0"
- ");"
+ ", server_ordinal_in_parent blob, transaction_version bigint default "
+ "0);"
"CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda"
"y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defa"
"ult -2, cache_guid TEXT , notification_state BLOB, bag_of_chips "
@@ -2746,11 +2747,12 @@ TEST_F(DirectoryBackingStoreTest, MigrateVersion78To79) {
// Ensure the next_id has been incremented.
MetahandlesIndex entry_bucket;
+ JournalIndex delete_journals;;
STLElementDeleter<MetahandlesIndex> deleter(&entry_bucket);
Directory::KernelLoadInfo load_info;
s.Clear();
- ASSERT_TRUE(dbs->Load(&entry_bucket, &load_info));
+ ASSERT_TRUE(dbs->Load(&entry_bucket, &delete_journals, &load_info));
EXPECT_LE(load_info.kernel_info.next_id, kInitialNextId - 65536);
}
@@ -2768,10 +2770,11 @@ TEST_F(DirectoryBackingStoreTest, MigrateVersion79To80) {
// Ensure the bag_of_chips has been set.
MetahandlesIndex entry_bucket;
+ JournalIndex delete_journals;;
STLElementDeleter<MetahandlesIndex> deleter(&entry_bucket);
Directory::KernelLoadInfo load_info;
- ASSERT_TRUE(dbs->Load(&entry_bucket, &load_info));
+ ASSERT_TRUE(dbs->Load(&entry_bucket, &delete_journals, &load_info));
// Check that the initial value is the serialization of an empty ChipBag.
sync_pb::ChipBag chip_bag;
std::string serialized_chip_bag;
@@ -2829,10 +2832,11 @@ TEST_F(DirectoryBackingStoreTest, DetectInvalidOrdinal) {
// Trying to unpack this entry should signal that the DB is corrupted.
MetahandlesIndex entry_bucket;
+ JournalIndex delete_journals;;
STLElementDeleter<MetahandlesIndex> deleter(&entry_bucket);
Directory::KernelLoadInfo kernel_load_info;
ASSERT_EQ(FAILED_DATABASE_CORRUPT,
- dbs->Load(&entry_bucket, &kernel_load_info));
+ dbs->Load(&entry_bucket, &delete_journals, &kernel_load_info));
}
TEST_F(DirectoryBackingStoreTest, MigrateVersion81To82) {
@@ -2972,12 +2976,13 @@ TEST_P(MigrationTest, ToCurrentVersion) {
syncable::Directory::KernelLoadInfo dir_info;
MetahandlesIndex index;
+ JournalIndex delete_journals;;
STLElementDeleter<MetahandlesIndex> index_deleter(&index);
{
scoped_ptr<TestDirectoryBackingStore> dbs(
new TestDirectoryBackingStore(GetUsername(), &connection));
- ASSERT_EQ(OPENED, dbs->Load(&index, &dir_info));
+ ASSERT_EQ(OPENED, dbs->Load(&index, &delete_journals, &dir_info));
ASSERT_FALSE(dbs->needs_column_refresh_);
ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion());
}
@@ -3249,16 +3254,18 @@ TEST_F(DirectoryBackingStoreTest, DeleteEntries) {
scoped_ptr<TestDirectoryBackingStore> dbs(
new TestDirectoryBackingStore(GetUsername(), &connection));
MetahandlesIndex index;
+ JournalIndex delete_journals;;
Directory::KernelLoadInfo kernel_load_info;
STLElementDeleter<MetahandlesIndex> index_deleter(&index);
- dbs->Load(&index, &kernel_load_info);
+ dbs->Load(&index, &delete_journals, &kernel_load_info);
size_t initial_size = index.size();
ASSERT_LT(0U, initial_size) << "Test requires entries to delete.";
int64 first_to_die = (*index.begin())->ref(META_HANDLE);
MetahandleSet to_delete;
to_delete.insert(first_to_die);
- EXPECT_TRUE(dbs->DeleteEntries(to_delete));
+ EXPECT_TRUE(dbs->DeleteEntries(DirectoryBackingStore::METAS_TABLE,
+ to_delete));
STLDeleteElements(&index);
dbs->LoadEntries(&index);
@@ -3280,7 +3287,8 @@ TEST_F(DirectoryBackingStoreTest, DeleteEntries) {
to_delete.insert((*it)->ref(META_HANDLE));
}
- EXPECT_TRUE(dbs->DeleteEntries(to_delete));
+ EXPECT_TRUE(dbs->DeleteEntries(DirectoryBackingStore::METAS_TABLE,
+ to_delete));
STLDeleteElements(&index);
dbs->LoadEntries(&index);

Powered by Google App Engine
This is Rietveld 408576698