diff options
Diffstat (limited to 'sync/syncable/directory_unittest.cc')
-rw-r--r-- | sync/syncable/directory_unittest.cc | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc index dc83e61..59ac4f8 100644 --- a/sync/syncable/directory_unittest.cc +++ b/sync/syncable/directory_unittest.cc @@ -4,8 +4,12 @@ #include "sync/syncable/directory_unittest.h" +#include <stddef.h> +#include <stdint.h> + #include <cstdlib> +#include "base/macros.h" #include "base/rand_util.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" @@ -188,11 +192,11 @@ void SyncableDirectoryTest::CheckPurgeEntriesWithTypeInSucceeded( EXPECT_TRUE(dir_->InitialSyncEndedForType(BOOKMARKS)); } -bool SyncableDirectoryTest::IsInDirtyMetahandles(int64 metahandle) { +bool SyncableDirectoryTest::IsInDirtyMetahandles(int64_t metahandle) { return 1 == dir_->kernel()->dirty_metahandles.count(metahandle); } -bool SyncableDirectoryTest::IsInMetahandlesToPurge(int64 metahandle) { +bool SyncableDirectoryTest::IsInMetahandlesToPurge(int64_t metahandle) { return 1 == dir_->kernel()->metahandles_to_purge.count(metahandle); } @@ -215,11 +219,11 @@ SyncableDirectoryTest::unrecoverable_error_handler() { } void SyncableDirectoryTest::ValidateEntry(BaseTransaction* trans, - int64 id, + int64_t id, bool check_name, const std::string& name, - int64 base_version, - int64 server_version, + int64_t base_version, + int64_t server_version, bool is_del) { Entry e(trans, GET_BY_ID, TestIdFactory::FromNumber(id)); ASSERT_TRUE(e.good()); @@ -276,7 +280,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsMetahandlesToPurge) { TEST_F(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest) { const int metahandles_to_create = 100; - std::vector<int64> expected_dirty_metahandles; + std::vector<int64_t> expected_dirty_metahandles; { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); for (int i = 0; i < metahandles_to_create; i++) { @@ -303,11 +307,10 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest) { // Put a new value with existing transactions as well as adding new ones. { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); - std::vector<int64> new_dirty_metahandles; - for (std::vector<int64>::const_iterator i = + std::vector<int64_t> new_dirty_metahandles; + for (std::vector<int64_t>::const_iterator i = expected_dirty_metahandles.begin(); - i != expected_dirty_metahandles.end(); - ++i) { + i != expected_dirty_metahandles.end(); ++i) { // Change existing entries to directories to dirty them. MutableEntry e1(&trans, GET_BY_HANDLE, *i); e1.PutIsDir(true); @@ -343,7 +346,7 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest) { // half of 2 * metahandles_to_create const unsigned int number_changed = 100u; - std::vector<int64> expected_dirty_metahandles; + std::vector<int64_t> expected_dirty_metahandles; { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); for (int i = 0; i < metahandles_to_create; i++) { @@ -356,11 +359,10 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest) { // Put a new value with existing transactions as well as adding new ones. { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); - std::vector<int64> new_dirty_metahandles; - for (std::vector<int64>::const_iterator i = + std::vector<int64_t> new_dirty_metahandles; + for (std::vector<int64_t>::const_iterator i = expected_dirty_metahandles.begin(); - i != expected_dirty_metahandles.end(); - ++i) { + i != expected_dirty_metahandles.end(); ++i) { // Change existing entries to directories to dirty them. MutableEntry e1(&trans, GET_BY_HANDLE, *i); ASSERT_TRUE(e1.good()); @@ -379,10 +381,9 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest) { // Don't make any changes whatsoever and ensure nothing comes back. { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); - for (std::vector<int64>::const_iterator i = + for (std::vector<int64_t>::const_iterator i = expected_dirty_metahandles.begin(); - i != expected_dirty_metahandles.end(); - ++i) { + i != expected_dirty_metahandles.end(); ++i) { MutableEntry e(&trans, GET_BY_HANDLE, *i); ASSERT_TRUE(e.good()); // We aren't doing anything to dirty these entries. @@ -400,10 +401,9 @@ TEST_F(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest) { { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); bool should_change = false; - for (std::vector<int64>::const_iterator i = + for (std::vector<int64_t>::const_iterator i = expected_dirty_metahandles.begin(); - i != expected_dirty_metahandles.end(); - ++i) { + i != expected_dirty_metahandles.end(); ++i) { // Maybe change entries by flipping IS_DIR. MutableEntry e(&trans, GET_BY_HANDLE, *i); ASSERT_TRUE(e.good()); @@ -443,9 +443,9 @@ TEST_F(SyncableDirectoryTest, ManageDeleteJournals) { Id id2 = TestIdFactory::FromNumber(2); // The third one is a client ID. Id id3 = TestIdFactory::FromNumber(-3); - int64 handle1 = 0; - int64 handle2 = 0; - int64 handle3 = 0; + int64_t handle1 = 0; + int64_t handle2 = 0; + int64_t handle3 = 0; { // Create 3 bookmark entries and save in database. { @@ -587,7 +587,7 @@ TEST_F(SyncableDirectoryTest, TestPurgeDeletedEntriesOnReload) { const int kClientCount = 2; const int kServerCount = 5; const int kTestCount = kClientCount + kServerCount; - int64 handles[kTestCount]; + int64_t handles[kTestCount]; // The idea is to recreate various combinations of IDs, IS_DEL, // IS_UNSYNCED, and IS_UNAPPLIED_UPDATE flags to test all combinations @@ -643,11 +643,11 @@ TEST_F(SyncableDirectoryTest, TestPurgeDeletedEntriesOnReload) { // - Item 0 is an item with IS_DEL flag and client ID. // - Item 5 is an item with IS_DEL flag which has both // IS_UNSYNCED and IS_UNAPPLIED_UPDATE unset. - std::vector<int64> expected_purged; + std::vector<int64_t> expected_purged; expected_purged.push_back(0); expected_purged.push_back(5); - std::vector<int64> actually_purged; + std::vector<int64_t> actually_purged; { ReadTransaction trans(FROM_HERE, dir().get()); for (int i = 0; i < kTestCount; i++) { @@ -698,7 +698,7 @@ TEST_F(SyncableDirectoryTest, TestDelete) { TEST_F(SyncableDirectoryTest, TestGetUnsynced) { Directory::Metahandles handles; - int64 handle1, handle2; + int64_t handle1, handle2; { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); @@ -768,8 +768,8 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) { } TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { - std::vector<int64> handles; - int64 handle1, handle2; + std::vector<int64_t> handles; + int64_t handle1, handle2; const FullModelTypeSet all_types = FullModelTypeSet::All(); { WriteTransaction trans(FROM_HERE, UNITTEST, dir().get()); @@ -842,7 +842,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) { TEST_F(SyncableDirectoryTest, DeleteBug_531383) { // Try to evoke a check failure... TestIdFactory id_factory; - int64 grandchild_handle; + int64_t grandchild_handle; { WriteTransaction wtrans(FROM_HERE, UNITTEST, dir().get()); MutableEntry parent(&wtrans, CREATE, BOOKMARKS, id_factory.root(), "Bob"); @@ -930,7 +930,7 @@ TEST_F(SyncableDirectoryTest, TestIsLegalNewParent) { TEST_F(SyncableDirectoryTest, TestEntryIsInFolder) { // Create a subdir and an entry. - int64 entry_handle; + int64_t entry_handle; syncable::Id folder_id; syncable::Id entry_id; std::string entry_name = "entry"; @@ -1420,7 +1420,7 @@ TEST_F(SyncableDirectoryTest, BadPositionCountsAsCorruption) { } TEST_F(SyncableDirectoryTest, General) { - int64 written_metahandle; + int64_t written_metahandle; const Id id = TestIdFactory::FromNumber(99); std::string name = "Jeff"; // Test simple read operations on an empty DB. @@ -1497,7 +1497,7 @@ TEST_F(SyncableDirectoryTest, General) { } TEST_F(SyncableDirectoryTest, ChildrenOps) { - int64 written_metahandle; + int64_t written_metahandle; const Id id = TestIdFactory::FromNumber(99); std::string name = "Jeff"; { @@ -1558,7 +1558,7 @@ TEST_F(SyncableDirectoryTest, ChildrenOps) { } TEST_F(SyncableDirectoryTest, ClientIndexRebuildsProperly) { - int64 written_metahandle; + int64_t written_metahandle; TestIdFactory factory; const Id id = factory.NewServerId(); std::string name = "cheesepuffs"; |