summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/test
diff options
context:
space:
mode:
authorhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-22 23:53:56 +0000
committerhaitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-22 23:53:56 +0000
commit95a083fa27868960efe258e099aa49488260edd8 (patch)
tree4e382e00534d63fd35370683d00084a5941809cf /sync/internal_api/test
parent1d5617b5e88655c275a4e0b4606138fbeb6d1416 (diff)
downloadchromium_src-95a083fa27868960efe258e099aa49488260edd8.zip
chromium_src-95a083fa27868960efe258e099aa49488260edd8.tar.gz
chromium_src-95a083fa27868960efe258e099aa49488260edd8.tar.bz2
Use delete journal to remove bookmarks that are already deleted in sync model
before assocating bookmark model and sync model. BUG=121928 Review URL: https://chromiumcodereview.appspot.com/11533008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/test')
-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