summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/test/test_user_share.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sync/internal_api/test/test_user_share.cc')
-rw-r--r--sync/internal_api/test/test_user_share.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/sync/internal_api/test/test_user_share.cc b/sync/internal_api/test/test_user_share.cc
index 2057eac..9434617 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