OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 // | |
5 // Utilities that are useful in verifying the state of items in a | |
6 // syncable database. | |
7 | |
8 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | |
9 #define CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | |
10 #pragma once | |
11 | |
12 #include <string> | |
13 | |
14 #include "chrome/browser/sync/syncable/syncable.h" | |
15 | |
16 namespace syncable { | |
17 | |
18 class BaseTransaction; | |
19 class Id; | |
20 | |
21 // Count the number of entries with a given name inside of a parent. | |
22 // Useful to check folder structure and for porting older tests that | |
23 // rely on uniqueness inside of folders. | |
24 int CountEntriesWithName(BaseTransaction* rtrans, | |
25 const syncable::Id& parent_id, | |
26 const std::string& name); | |
27 | |
28 // Get the first entry ID with name in a parent. The entry *must* exist. | |
29 Id GetFirstEntryWithName(BaseTransaction* rtrans, | |
30 const syncable::Id& parent_id, | |
31 const std::string& name); | |
32 | |
33 // Assert that there's only one entry by this name in this parent. | |
34 // Return the Id. | |
35 Id GetOnlyEntryWithName(BaseTransaction* rtrans, | |
36 const syncable::Id& parent_id, | |
37 const std::string& name); | |
38 | |
39 } // namespace syncable | |
40 | |
41 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_TEST_SYNCABLE_UTILS_H_ | |
OLD | NEW |