OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ | 5 #ifndef SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ |
6 #define SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ | 6 #define SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "sync/syncable/in_memory_directory_backing_store.h" | 13 #include "sync/syncable/in_memory_directory_backing_store.h" |
13 #include "sync/syncable/mutable_entry.h" | 14 #include "sync/syncable/mutable_entry.h" |
14 #include "sync/syncable/syncable_read_transaction.h" | 15 #include "sync/syncable/syncable_read_transaction.h" |
15 #include "sync/syncable/syncable_write_transaction.h" | 16 #include "sync/syncable/syncable_write_transaction.h" |
16 #include "sync/test/engine/test_id_factory.h" | 17 #include "sync/test/engine/test_id_factory.h" |
17 #include "sync/test/fake_encryptor.h" | 18 #include "sync/test/fake_encryptor.h" |
18 #include "sync/test/null_directory_change_delegate.h" | 19 #include "sync/test/null_directory_change_delegate.h" |
19 #include "sync/test/null_transaction_observer.h" | 20 #include "sync/test/null_transaction_observer.h" |
20 #include "sync/util/test_unrecoverable_error_handler.h" | 21 #include "sync/util/test_unrecoverable_error_handler.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 DirOpenResult SimulateSaveAndReloadDir(); | 76 DirOpenResult SimulateSaveAndReloadDir(); |
76 | 77 |
77 // This function will close and re-open the directory without saving any | 78 // This function will close and re-open the directory without saving any |
78 // pending changes. This is intended to simulate the recovery from a crash | 79 // pending changes. This is intended to simulate the recovery from a crash |
79 // scenario. The same warnings for SimulateSaveAndReloadDir apply here. | 80 // scenario. The same warnings for SimulateSaveAndReloadDir apply here. |
80 DirOpenResult SimulateCrashAndReloadDir(); | 81 DirOpenResult SimulateCrashAndReloadDir(); |
81 | 82 |
82 void GetAllMetaHandles(BaseTransaction* trans, MetahandleSet* result); | 83 void GetAllMetaHandles(BaseTransaction* trans, MetahandleSet* result); |
83 void CheckPurgeEntriesWithTypeInSucceeded(ModelTypeSet types_to_purge, | 84 void CheckPurgeEntriesWithTypeInSucceeded(ModelTypeSet types_to_purge, |
84 bool before_reload); | 85 bool before_reload); |
85 bool IsInDirtyMetahandles(int64 metahandle); | 86 bool IsInDirtyMetahandles(int64_t metahandle); |
86 bool IsInMetahandlesToPurge(int64 metahandle); | 87 bool IsInMetahandlesToPurge(int64_t metahandle); |
87 | 88 |
88 scoped_ptr<Directory>& dir(); | 89 scoped_ptr<Directory>& dir(); |
89 DirectoryChangeDelegate* directory_change_delegate(); | 90 DirectoryChangeDelegate* directory_change_delegate(); |
90 Encryptor* encryptor(); | 91 Encryptor* encryptor(); |
91 TestUnrecoverableErrorHandler* unrecoverable_error_handler(); | 92 TestUnrecoverableErrorHandler* unrecoverable_error_handler(); |
92 | 93 |
93 private: | 94 private: |
94 void ValidateEntry(BaseTransaction* trans, | 95 void ValidateEntry(BaseTransaction* trans, |
95 int64 id, | 96 int64_t id, |
96 bool check_name, | 97 bool check_name, |
97 const std::string& name, | 98 const std::string& name, |
98 int64 base_version, | 99 int64_t base_version, |
99 int64 server_version, | 100 int64_t server_version, |
100 bool is_del); | 101 bool is_del); |
101 | 102 |
102 base::MessageLoop message_loop_; | 103 base::MessageLoop message_loop_; |
103 scoped_ptr<Directory> dir_; | 104 scoped_ptr<Directory> dir_; |
104 NullDirectoryChangeDelegate delegate_; | 105 NullDirectoryChangeDelegate delegate_; |
105 FakeEncryptor encryptor_; | 106 FakeEncryptor encryptor_; |
106 TestUnrecoverableErrorHandler handler_; | 107 TestUnrecoverableErrorHandler handler_; |
107 sql::Connection connection_; | 108 sql::Connection connection_; |
108 }; | 109 }; |
109 | 110 |
110 } // namespace syncable | 111 } // namespace syncable |
111 | 112 |
112 } // namespace syncer | 113 } // namespace syncer |
113 | 114 |
114 #endif // SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ | 115 #endif // SYNC_SYNCABLE_DIRECTORY_UNITTEST_H_ |
OLD | NEW |