| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ | 8 #ifndef CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ |
| 9 #define CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ | 9 #define CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ |
| 10 | 10 |
| 11 #include <string> |
| 12 |
| 11 #include "chrome/browser/sync/syncable/syncable.h" | 13 #include "chrome/browser/sync/syncable/syncable.h" |
| 12 | 14 |
| 13 namespace syncable { | 15 namespace syncable { |
| 14 | 16 |
| 15 class BaseTransaction; | 17 class BaseTransaction; |
| 16 class Id; | 18 class Id; |
| 17 | 19 |
| 18 // Count the number of entries with a given name inside of a parent. | 20 // Count the number of entries with a given name inside of a parent. |
| 19 // Useful to check folder structure and for porting older tests that | 21 // Useful to check folder structure and for porting older tests that |
| 20 // rely on uniqueness inside of folders. | 22 // rely on uniqueness inside of folders. |
| 21 int CountEntriesWithName(BaseTransaction* rtrans, | 23 int CountEntriesWithName(BaseTransaction* rtrans, |
| 22 const syncable::Id& parent_id, | 24 const syncable::Id& parent_id, |
| 23 const PathString& name); | 25 const std::string& name); |
| 24 | 26 |
| 25 // Get the first entry ID with name in a parent. The entry *must* exist. | 27 // Get the first entry ID with name in a parent. The entry *must* exist. |
| 26 Id GetFirstEntryWithName(BaseTransaction* rtrans, | 28 Id GetFirstEntryWithName(BaseTransaction* rtrans, |
| 27 const syncable::Id& parent_id, | 29 const syncable::Id& parent_id, |
| 28 const PathString& name); | 30 const std::string& name); |
| 29 | 31 |
| 30 // Assert that there's only one entry by this name in this parent. | 32 // Assert that there's only one entry by this name in this parent. |
| 31 // Return the Id. | 33 // Return the Id. |
| 32 Id GetOnlyEntryWithName(BaseTransaction* rtrans, | 34 Id GetOnlyEntryWithName(BaseTransaction* rtrans, |
| 33 const syncable::Id& parent_id, | 35 const syncable::Id& parent_id, |
| 34 const PathString& name); | 36 const std::string& name); |
| 35 | 37 |
| 36 } // namespace syncable | 38 } // namespace syncable |
| 37 | 39 |
| 38 #endif // CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ | 40 #endif // CHROME_TEST_SYNC_ENGINE_TEST_SYNCABLE_UTILS_H_ |
| OLD | NEW |