OLD | NEW |
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 "components/sync/core/test/test_user_share.h" | 5 #include "components/sync/core/test/test_user_share.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "components/sync/syncable/directory.h" | 10 #include "components/sync/syncable/directory.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 ignore_result(user_share_->directory.release()); | 39 ignore_result(user_share_->directory.release()); |
40 | 40 |
41 user_share_.reset(); | 41 user_share_.reset(); |
42 dir_maker_->TearDown(); | 42 dir_maker_->TearDown(); |
43 } | 43 } |
44 | 44 |
45 bool TestUserShare::Reload() { | 45 bool TestUserShare::Reload() { |
46 if (!user_share_->directory->SaveChanges()) | 46 if (!user_share_->directory->SaveChanges()) |
47 return false; | 47 return false; |
48 | 48 |
49 syncer::syncable::DirectoryBackingStore* saved_store = | 49 syncable::DirectoryBackingStore* saved_store = |
50 user_share_->directory->store_.release(); | 50 user_share_->directory->store_.release(); |
51 | 51 |
52 // Ensure the unique_ptr doesn't delete the memory we don't own. | 52 // Ensure the unique_ptr doesn't delete the memory we don't own. |
53 ignore_result(user_share_->directory.release()); | 53 ignore_result(user_share_->directory.release()); |
54 user_share_.reset(new UserShare()); | 54 user_share_.reset(new UserShare()); |
55 dir_maker_->SetUpWith(saved_store); | 55 dir_maker_->SetUpWith(saved_store); |
56 user_share_->directory.reset(dir_maker_->directory()); | 56 user_share_->directory.reset(dir_maker_->directory()); |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 UserShare* TestUserShare::user_share() { | 60 UserShare* TestUserShare::user_share() { |
61 return user_share_.get(); | 61 return user_share_.get(); |
62 } | 62 } |
63 | 63 |
64 SyncEncryptionHandler* TestUserShare::encryption_handler() { | 64 SyncEncryptionHandler* TestUserShare::encryption_handler() { |
65 return dir_maker_->encryption_handler(); | 65 return dir_maker_->encryption_handler(); |
66 } | 66 } |
67 | 67 |
68 syncable::TestTransactionObserver* TestUserShare::transaction_observer() { | 68 syncable::TestTransactionObserver* TestUserShare::transaction_observer() { |
69 return dir_maker_->transaction_observer(); | 69 return dir_maker_->transaction_observer(); |
70 } | 70 } |
71 | 71 |
72 /* static */ | 72 /* static */ |
73 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { | 73 bool TestUserShare::CreateRoot(ModelType model_type, UserShare* user_share) { |
74 syncer::syncable::Directory* directory = user_share->directory.get(); | 74 syncable::Directory* directory = user_share->directory.get(); |
75 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); | 75 syncable::WriteTransaction wtrans(FROM_HERE, syncable::UNITTEST, directory); |
76 CreateTypeRoot(&wtrans, directory, model_type); | 76 CreateTypeRoot(&wtrans, directory, model_type); |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 size_t TestUserShare::GetDeleteJournalSize() const { | 80 size_t TestUserShare::GetDeleteJournalSize() const { |
81 syncable::ReadTransaction trans(FROM_HERE, user_share_->directory.get()); | 81 syncable::ReadTransaction trans(FROM_HERE, user_share_->directory.get()); |
82 return user_share_->directory->delete_journal()->GetDeleteJournalSize(&trans); | 82 return user_share_->directory->delete_journal()->GetDeleteJournalSize(&trans); |
83 } | 83 } |
84 | 84 |
85 } // namespace syncer | 85 } // namespace syncer |
OLD | NEW |