Index: sync/internal_api/test/test_user_share.cc |
diff --git a/sync/internal_api/test/test_user_share.cc b/sync/internal_api/test/test_user_share.cc |
index 2057eacff8fa1bfab94e08567793fd84b712f99b..94346177045933855ab19ab9a6e150a6fc92f697 100644 |
--- a/sync/internal_api/test/test_user_share.cc |
+++ b/sync/internal_api/test/test_user_share.cc |
@@ -7,6 +7,7 @@ |
#include "base/compiler_specific.h" |
#include "sync/syncable/directory.h" |
#include "sync/syncable/mutable_entry.h" |
+#include "sync/syncable/syncable_read_transaction.h" |
#include "sync/syncable/syncable_write_transaction.h" |
#include "sync/test/engine/test_directory_setter_upper.h" |
#include "sync/test/engine/test_id_factory.h" |
@@ -39,6 +40,21 @@ void TestUserShare::TearDown() { |
dir_maker_->TearDown(); |
} |
+bool TestUserShare::Reload() { |
+ if (!user_share_->directory->SaveChanges()) |
+ return false; |
+ |
+ syncer::syncable::DirectoryBackingStore* saved_store = |
+ user_share_->directory->store_.release(); |
+ |
+ // Ensure the scoped_ptr doesn't delete the memory we don't own. |
+ ignore_result(user_share_->directory.release()); |
+ user_share_.reset(new UserShare()); |
+ dir_maker_->SetUpWith(saved_store); |
+ user_share_->directory.reset(dir_maker_->directory()); |
+ return true; |
+} |
+ |
UserShare* TestUserShare::user_share() { |
return user_share_.get(); |
} |
@@ -59,4 +75,9 @@ bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { |
return true; |
} |
+size_t TestUserShare::GetDeleteJournalSize() const { |
+ syncable::ReadTransaction trans(FROM_HERE, user_share_->directory.get()); |
+ return user_share_->directory->delete_journal()->GetDeleteJournalSize(&trans); |
+} |
+ |
} // namespace syncer |