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

Side by Side Diff: sync/internal_api/test/test_user_share.cc

Issue 11533008: Use delete journal to remove bookmarks that are already deleted in sync model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « sync/internal_api/public/test/test_user_share.h ('k') | sync/sync.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "sync/internal_api/public/test/test_user_share.h" 5 #include "sync/internal_api/public/test/test_user_share.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "sync/syncable/directory.h" 8 #include "sync/syncable/directory.h"
9 #include "sync/syncable/mutable_entry.h" 9 #include "sync/syncable/mutable_entry.h"
10 #include "sync/syncable/syncable_read_transaction.h"
10 #include "sync/syncable/syncable_write_transaction.h" 11 #include "sync/syncable/syncable_write_transaction.h"
11 #include "sync/test/engine/test_directory_setter_upper.h" 12 #include "sync/test/engine/test_directory_setter_upper.h"
12 #include "sync/test/engine/test_id_factory.h" 13 #include "sync/test/engine/test_id_factory.h"
13 #include "sync/test/engine/test_syncable_utils.h" 14 #include "sync/test/engine/test_syncable_utils.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace syncer { 17 namespace syncer {
17 18
18 TestUserShare::TestUserShare() : dir_maker_(new TestDirectorySetterUpper()) {} 19 TestUserShare::TestUserShare() : dir_maker_(new TestDirectorySetterUpper()) {}
19 20
(...skipping 12 matching lines...) Expand all
32 } 33 }
33 34
34 void TestUserShare::TearDown() { 35 void TestUserShare::TearDown() {
35 // Ensure the scoped_ptr doesn't delete the memory we don't own. 36 // Ensure the scoped_ptr doesn't delete the memory we don't own.
36 ignore_result(user_share_->directory.release()); 37 ignore_result(user_share_->directory.release());
37 38
38 user_share_.reset(); 39 user_share_.reset();
39 dir_maker_->TearDown(); 40 dir_maker_->TearDown();
40 } 41 }
41 42
43 bool TestUserShare::Reload() {
44 if (!user_share_->directory->SaveChanges())
45 return false;
46
47 syncer::syncable::DirectoryBackingStore* saved_store =
48 user_share_->directory->store_.release();
49
50 // Ensure the scoped_ptr doesn't delete the memory we don't own.
51 ignore_result(user_share_->directory.release());
52 user_share_.reset(new UserShare());
53 dir_maker_->SetUpWith(saved_store);
54 user_share_->directory.reset(dir_maker_->directory());
55 return true;
56 }
57
42 UserShare* TestUserShare::user_share() { 58 UserShare* TestUserShare::user_share() {
43 return user_share_.get(); 59 return user_share_.get();
44 } 60 }
45 61
46 SyncEncryptionHandler* TestUserShare::encryption_handler() { 62 SyncEncryptionHandler* TestUserShare::encryption_handler() {
47 return dir_maker_->encryption_handler(); 63 return dir_maker_->encryption_handler();
48 } 64 }
49 65
50 syncable::TestTransactionObserver* TestUserShare::transaction_observer() { 66 syncable::TestTransactionObserver* TestUserShare::transaction_observer() {
51 return dir_maker_->transaction_observer(); 67 return dir_maker_->transaction_observer();
52 } 68 }
53 69
54 /* static */ 70 /* static */
55 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { 71 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) {
56 syncer::syncable::Directory* directory = user_share->directory.get(); 72 syncer::syncable::Directory* directory = user_share->directory.get();
57 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); 73 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory);
58 CreateTypeRoot(&wtrans, directory, model_type); 74 CreateTypeRoot(&wtrans, directory, model_type);
59 return true; 75 return true;
60 } 76 }
61 77
78 size_t TestUserShare::GetDeleteJournalSize() const {
79 syncable::ReadTransaction trans(FROM_HERE, user_share_->directory.get());
80 return user_share_->directory->delete_journal()->GetDeleteJournalSize(&trans);
81 }
82
62 } // namespace syncer 83 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/test/test_user_share.h ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698