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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/metadata_database_unittest.cc

Issue 388913005: [SyncFS] Migrate ServiceMetadata from MDDB to MDDBIndex. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work for nits 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/metadata_database.h" 5 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Implies the file should not in the database. 47 // Implies the file should not in the database.
48 bool should_be_absent; 48 bool should_be_absent;
49 49
50 // Implies the file should have a tracker in the database but should have no 50 // Implies the file should have a tracker in the database but should have no
51 // metadata. 51 // metadata.
52 bool tracker_only; 52 bool tracker_only;
53 53
54 TrackedFile() : should_be_absent(false), tracker_only(false) {} 54 TrackedFile() : should_be_absent(false), tracker_only(false) {}
55 }; 55 };
56 56
57 void ExpectEquivalent(const ServiceMetadata* left, 57 void ExpectEquivalentServiceMetadata(
58 const ServiceMetadata* right) { 58 const MetadataDatabaseIndexInterface* left,
59 test_util::ExpectEquivalentServiceMetadata(*left, *right); 59 const MetadataDatabaseIndexInterface* right) {
60 EXPECT_EQ(left->GetLargestChangeID(), right->GetLargestChangeID());
61 EXPECT_EQ(left->GetSyncRootTrackerID(), right->GetSyncRootTrackerID());
62 EXPECT_EQ(left->GetNextTrackerID(), right->GetNextTrackerID());
60 } 63 }
61 64
62 void ExpectEquivalent(const FileMetadata* left, const FileMetadata* right) { 65 void ExpectEquivalent(const FileMetadata* left, const FileMetadata* right) {
63 if (!left) { 66 if (!left) {
64 ASSERT_FALSE(right); 67 ASSERT_FALSE(right);
65 return; 68 return;
66 } 69 }
67 ASSERT_TRUE(right); 70 ASSERT_TRUE(right);
68 test_util::ExpectEquivalentMetadata(*left, *right); 71 test_util::ExpectEquivalentMetadata(*left, *right);
69 } 72 }
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 &metadata_database_2)); 471 &metadata_database_2));
469 metadata_database_->db_ = metadata_database_2->db_.Pass(); 472 metadata_database_->db_ = metadata_database_2->db_.Pass();
470 473
471 const MetadataDatabaseIndex* on_memory = 474 const MetadataDatabaseIndex* on_memory =
472 static_cast<MetadataDatabaseIndex*>(metadata_database_->index_.get()); 475 static_cast<MetadataDatabaseIndex*>(metadata_database_->index_.get());
473 const MetadataDatabaseIndex* reloaded = 476 const MetadataDatabaseIndex* reloaded =
474 static_cast<MetadataDatabaseIndex*>(metadata_database_2->index_.get()); 477 static_cast<MetadataDatabaseIndex*>(metadata_database_2->index_.get());
475 478
476 { 479 {
477 SCOPED_TRACE("Expect equivalent service_metadata"); 480 SCOPED_TRACE("Expect equivalent service_metadata");
478 ExpectEquivalent(metadata_database_->service_metadata_.get(), 481 ExpectEquivalentServiceMetadata(metadata_database_->index_.get(),
479 metadata_database_2->service_metadata_.get()); 482 metadata_database_2->index_.get());
480 } 483 }
481 484
482 { 485 {
483 SCOPED_TRACE("Expect equivalent metadata_by_id_ contents."); 486 SCOPED_TRACE("Expect equivalent metadata_by_id_ contents.");
484 ExpectEquivalent(on_memory->metadata_by_id_, 487 ExpectEquivalent(on_memory->metadata_by_id_,
485 reloaded->metadata_by_id_); 488 reloaded->metadata_by_id_);
486 } 489 }
487 490
488 { 491 {
489 SCOPED_TRACE("Expect equivalent tracker_by_id_ contents."); 492 SCOPED_TRACE("Expect equivalent tracker_by_id_ contents.");
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 EXPECT_TRUE(file->HasKey("details")); 1159 EXPECT_TRUE(file->HasKey("details"));
1157 1160
1158 ASSERT_TRUE(files->GetDictionary(1, &file)); 1161 ASSERT_TRUE(files->GetDictionary(1, &file));
1159 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0"); 1162 EXPECT_TRUE(file->GetString("title", &str) && str == "file_0");
1160 EXPECT_TRUE(file->GetString("type", &str) && str == "file"); 1163 EXPECT_TRUE(file->GetString("type", &str) && str == "file");
1161 EXPECT_TRUE(file->HasKey("details")); 1164 EXPECT_TRUE(file->HasKey("details"));
1162 } 1165 }
1163 1166
1164 } // namespace drive_backend 1167 } // namespace drive_backend
1165 } // namespace sync_file_system 1168 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698