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