OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // Utilities that are useful in verifying the state of items in a | 5 // Utilities that are useful in verifying the state of items in a |
6 // syncable database. | 6 // syncable database. |
7 | 7 |
8 #ifndef SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | 8 #ifndef SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ |
9 #define SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | 9 #define SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "sync/internal_api/public/base/model_type.h" |
| 14 |
13 namespace syncer { | 15 namespace syncer { |
14 namespace syncable { | 16 namespace syncable { |
15 | 17 |
16 class BaseTransaction; | 18 class BaseTransaction; |
| 19 class Directory; |
17 class Id; | 20 class Id; |
| 21 class WriteTransaction; |
18 | 22 |
19 // Count the number of entries with a given name inside of a parent. | 23 // Count the number of entries with a given name inside of a parent. |
20 // Useful to check folder structure and for porting older tests that | 24 // Useful to check folder structure and for porting older tests that |
21 // rely on uniqueness inside of folders. | 25 // rely on uniqueness inside of folders. |
22 int CountEntriesWithName(BaseTransaction* rtrans, | 26 int CountEntriesWithName(BaseTransaction* rtrans, |
23 const syncable::Id& parent_id, | 27 const syncable::Id& parent_id, |
24 const std::string& name); | 28 const std::string& name); |
25 | 29 |
26 // Get the first entry ID with name in a parent. The entry *must* exist. | 30 // Get the first entry ID with name in a parent. The entry *must* exist. |
27 Id GetFirstEntryWithName(BaseTransaction* rtrans, | 31 Id GetFirstEntryWithName(BaseTransaction* rtrans, |
28 const syncable::Id& parent_id, | 32 const syncable::Id& parent_id, |
29 const std::string& name); | 33 const std::string& name); |
30 | 34 |
31 // Assert that there's only one entry by this name in this parent. | 35 // Assert that there's only one entry by this name in this parent. |
32 // Return the Id. | 36 // Return the Id. |
33 Id GetOnlyEntryWithName(BaseTransaction* rtrans, | 37 Id GetOnlyEntryWithName(BaseTransaction* rtrans, |
34 const syncable::Id& parent_id, | 38 const syncable::Id& parent_id, |
35 const std::string& name); | 39 const std::string& name); |
36 | 40 |
| 41 void CreateTypeRoot(WriteTransaction* trans, |
| 42 syncable::Directory *dir, |
| 43 ModelType type); |
| 44 |
37 } // namespace syncable | 45 } // namespace syncable |
38 } // namespace syncer | 46 } // namespace syncer |
39 | 47 |
40 #endif // SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | 48 #endif // SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ |
OLD | NEW |