diff options
Diffstat (limited to 'sync/test/engine')
-rw-r--r-- | sync/test/engine/fake_model_worker.h | 2 | ||||
-rw-r--r-- | sync/test/engine/mock_commit_queue.cc | 23 | ||||
-rw-r--r-- | sync/test/engine/mock_commit_queue.h | 13 | ||||
-rw-r--r-- | sync/test/engine/mock_connection_manager.cc | 58 | ||||
-rw-r--r-- | sync/test/engine/mock_connection_manager.h | 76 | ||||
-rw-r--r-- | sync/test/engine/mock_model_type_processor.cc | 21 | ||||
-rw-r--r-- | sync/test/engine/mock_model_type_processor.h | 15 | ||||
-rw-r--r-- | sync/test/engine/mock_nudge_handler.h | 2 | ||||
-rw-r--r-- | sync/test/engine/single_type_mock_server.cc | 23 | ||||
-rw-r--r-- | sync/test/engine/single_type_mock_server.h | 14 | ||||
-rw-r--r-- | sync/test/engine/test_directory_setter_upper.h | 2 | ||||
-rw-r--r-- | sync/test/engine/test_id_factory.h | 4 |
12 files changed, 138 insertions, 115 deletions
diff --git a/sync/test/engine/fake_model_worker.h b/sync/test/engine/fake_model_worker.h index beb5400..603d769 100644 --- a/sync/test/engine/fake_model_worker.h +++ b/sync/test/engine/fake_model_worker.h @@ -7,8 +7,8 @@ #include <vector> -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/threading/non_thread_safe.h" #include "sync/internal_api/public/engine/model_safe_worker.h" #include "sync/internal_api/public/util/syncer_error.h" diff --git a/sync/test/engine/mock_commit_queue.cc b/sync/test/engine/mock_commit_queue.cc index e3a9a12..d6740c0 100644 --- a/sync/test/engine/mock_commit_queue.cc +++ b/sync/test/engine/mock_commit_queue.cc @@ -4,6 +4,9 @@ #include "sync/test/engine/mock_commit_queue.h" +#include <stddef.h> +#include <stdint.h> + #include "base/logging.h" namespace syncer_v2 { @@ -67,12 +70,12 @@ CommitRequestData MockCommitQueue::GetLatestCommitRequestForTagHash( } UpdateResponseData MockCommitQueue::UpdateFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash, const sync_pb::EntitySpecifics& specifics) { // Overwrite the existing server version if this is the new highest version. - int64 old_version = GetServerVersion(tag_hash); - int64 version = old_version + version_offset; + int64_t old_version = GetServerVersion(tag_hash); + int64_t version = old_version + version_offset; if (version > old_version) { SetServerVersion(tag_hash, version); } @@ -97,10 +100,10 @@ UpdateResponseData MockCommitQueue::UpdateFromServer( } UpdateResponseData MockCommitQueue::TombstoneFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash) { - int64 old_version = GetServerVersion(tag_hash); - int64 version = old_version + version_offset; + int64_t old_version = GetServerVersion(tag_hash); + int64_t version = old_version + version_offset; if (version > old_version) { SetServerVersion(tag_hash, version); } @@ -143,7 +146,7 @@ CommitResponseData MockCommitQueue::SuccessfulCommitResponse( response_data.sequence_number = request_data.sequence_number; // Increment the server version on successful commit. - int64 version = GetServerVersion(client_tag_hash); + int64_t version = GetServerVersion(client_tag_hash); version++; SetServerVersion(client_tag_hash, version); @@ -161,8 +164,8 @@ std::string MockCommitQueue::GenerateId(const std::string& tag_hash) { return "FakeId:" + tag_hash; } -int64 MockCommitQueue::GetServerVersion(const std::string& tag_hash) { - std::map<const std::string, int64>::const_iterator it; +int64_t MockCommitQueue::GetServerVersion(const std::string& tag_hash) { + std::map<const std::string, int64_t>::const_iterator it; it = server_versions_.find(tag_hash); if (it == server_versions_.end()) { return 0; @@ -172,7 +175,7 @@ int64 MockCommitQueue::GetServerVersion(const std::string& tag_hash) { } void MockCommitQueue::SetServerVersion(const std::string& tag_hash, - int64 version) { + int64_t version) { server_versions_[tag_hash] = version; } diff --git a/sync/test/engine/mock_commit_queue.h b/sync/test/engine/mock_commit_queue.h index 65a6e11..f217183 100644 --- a/sync/test/engine/mock_commit_queue.h +++ b/sync/test/engine/mock_commit_queue.h @@ -5,6 +5,9 @@ #ifndef SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_ #define SYNC_TEST_ENGINE_MOCK_COMMIT_QUEUE_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> @@ -45,13 +48,13 @@ class MockCommitQueue : public CommitQueue { // going backwards), reflections and redeliveries (ie. several instances of // the same version) or new updates. UpdateResponseData UpdateFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash, const sync_pb::EntitySpecifics& specifics); // Returns an UpdateResponseData representing a tombstone update from the // server. Updates server state accordingly. - UpdateResponseData TombstoneFromServer(int64 version_offset, + UpdateResponseData TombstoneFromServer(int64_t version_offset, const std::string& tag_hash); // Returns a commit response that indicates a successful commit of the @@ -69,15 +72,15 @@ class MockCommitQueue : public CommitQueue { static std::string GenerateId(const std::string& tag_hash); // Retrieve or set the server version. - int64 GetServerVersion(const std::string& tag_hash); - void SetServerVersion(const std::string& tag_hash, int64 version); + int64_t GetServerVersion(const std::string& tag_hash); + void SetServerVersion(const std::string& tag_hash, int64_t version); // A record of past commits requests. std::vector<CommitRequestDataList> commit_request_lists_; // Map of versions by client tag. // This is an essential part of the mocked server state. - std::map<const std::string, int64> server_versions_; + std::map<const std::string, int64_t> server_versions_; // Name of the encryption key in use on other clients. std::string server_encryption_key_name_; diff --git a/sync/test/engine/mock_connection_manager.cc b/sync/test/engine/mock_connection_manager.cc index a82ac63..5a7ecd9 100644 --- a/sync/test/engine/mock_connection_manager.cc +++ b/sync/test/engine/mock_connection_manager.cc @@ -6,6 +6,8 @@ #include "sync/test/engine/mock_connection_manager.h" +#include <stdint.h> + #include <map> #include "base/location.h" @@ -214,8 +216,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory( int id, int parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id) { return AddUpdateDirectory(TestIdFactory::FromNumber(id), @@ -245,8 +247,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateBookmark( int id, int parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const string& originator_client_item_id, const string& originator_cache_guid) { return AddUpdateBookmark(TestIdFactory::FromNumber(id), @@ -262,10 +264,10 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateSpecifics( int id, int parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir, - int64 position, + int64_t position, const sync_pb::EntitySpecifics& specifics) { sync_pb::SyncEntity* ent = AddUpdateMeta( TestIdFactory::FromNumber(id).GetServerId(), @@ -281,10 +283,10 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateSpecifics( int id, int parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir, - int64 position, + int64_t position, const sync_pb::EntitySpecifics& specifics, const string& originator_cache_guid, const string& originator_client_item_id) { @@ -297,8 +299,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateSpecifics( sync_pb::SyncEntity* MockConnectionManager::SetNigori( int id, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const sync_pb::EntitySpecifics& specifics) { sync_pb::SyncEntity* ent = GetUpdateResponse()->add_entries(); ent->set_id_string(TestIdFactory::FromNumber(id).GetServerId()); @@ -320,8 +322,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdatePref( const string& id, const string& parent_id, const string& client_tag, - int64 version, - int64 sync_ts) { + int64_t version, + int64_t sync_ts) { sync_pb::SyncEntity* ent = AddUpdateMeta(id, parent_id, " ", version, sync_ts); @@ -338,8 +340,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateFull( const string& id, const string& parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir) { sync_pb::SyncEntity* ent = AddUpdateMeta(id, parent_id, name, version, sync_ts); @@ -351,8 +353,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateMeta( const string& id, const string& parent_id, const string& name, - int64 version, - int64 sync_ts) { + int64_t version, + int64_t sync_ts) { sync_pb::SyncEntity* ent = GetUpdateResponse()->add_entries(); ent->set_id_string(id); ent->set_parent_id_string(parent_id); @@ -383,8 +385,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory( const string& id, const string& parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id) { sync_pb::SyncEntity* ret = @@ -398,8 +400,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateBookmark( const string& id, const string& parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const string& originator_cache_guid, const string& originator_client_item_id) { sync_pb::SyncEntity* ret = @@ -485,7 +487,7 @@ void MockConnectionManager::SetLastUpdateClientTag(const string& tag) { GetMutableLastUpdate()->set_client_defined_unique_tag(tag); } -void MockConnectionManager::SetLastUpdatePosition(int64 server_position) { +void MockConnectionManager::SetLastUpdatePosition(int64_t server_position) { GetMutableLastUpdate()->set_position_in_parent(server_position); } @@ -508,7 +510,7 @@ void MockConnectionManager::ApplyToken() { } } -void MockConnectionManager::SetChangesRemaining(int64 timestamp) { +void MockConnectionManager::SetChangesRemaining(int64_t timestamp) { GetUpdateResponse()->set_changes_remaining(timestamp); } @@ -669,8 +671,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory( syncable::Id id, syncable::Id parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const string& originator_cache_guid, const string& originator_client_item_id) { return AddUpdateDirectory(id.GetServerId(), parent_id.GetServerId(), @@ -682,8 +684,8 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateBookmark( syncable::Id id, syncable::Id parent_id, const string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const string& originator_cache_guid, const string& originator_client_item_id) { return AddUpdateBookmark(id.GetServerId(), parent_id.GetServerId(), diff --git a/sync/test/engine/mock_connection_manager.h b/sync/test/engine/mock_connection_manager.h index 6595fa0e..03baff3 100644 --- a/sync/test/engine/mock_connection_manager.h +++ b/sync/test/engine/mock_connection_manager.h @@ -7,6 +7,8 @@ #ifndef SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ #define SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ +#include <stdint.h> + #include <bitset> #include <list> #include <string> @@ -14,6 +16,7 @@ #include "base/callback.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" #include "base/synchronization/lock.h" #include "sync/engine/net/server_connection_manager.h" @@ -52,7 +55,7 @@ class MockConnectionManager : public ServerConnectionManager { void SetCommitTimeRename(const std::string& prepend); // Generic versions of AddUpdate functions. Tests using these function should - // compile for both the int64 and string id based versions of the server. + // compile for both the int64_t and string id based versions of the server. // The SyncEntity returned is only valid until the Sync is completed // (e.g. with SyncShare.) It allows to add further entity properties before // sync, using SetLastXXX() methods and/or GetMutableLastUpdate(). @@ -60,16 +63,16 @@ class MockConnectionManager : public ServerConnectionManager { syncable::Id id, syncable::Id parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); sync_pb::SyncEntity* AddUpdateBookmark( syncable::Id id, syncable::Id parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); // Versions of the AddUpdate functions that accept integer IDs. @@ -77,16 +80,16 @@ class MockConnectionManager : public ServerConnectionManager { int id, int parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); sync_pb::SyncEntity* AddUpdateBookmark( int id, int parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); // New protocol versions of the AddUpdate functions. @@ -94,16 +97,16 @@ class MockConnectionManager : public ServerConnectionManager { const std::string& id, const std::string& parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); sync_pb::SyncEntity* AddUpdateBookmark( const std::string& id, const std::string& parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, const std::string& originator_cache_guid, const std::string& originator_client_item_id); // Versions of the AddUpdate function that accept specifics. @@ -111,33 +114,32 @@ class MockConnectionManager : public ServerConnectionManager { int id, int parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir, - int64 position, + int64_t position, const sync_pb::EntitySpecifics& specifics); sync_pb::SyncEntity* AddUpdateSpecifics( int id, int parent_id, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir, - int64 position, + int64_t position, const sync_pb::EntitySpecifics& specifics, const std::string& originator_cache_guid, const std::string& originator_client_item_id); - sync_pb::SyncEntity* SetNigori( - int id, - int64 version, - int64 sync_ts, - const sync_pb::EntitySpecifics& specifics); + sync_pb::SyncEntity* SetNigori(int id, + int64_t version, + int64_t sync_ts, + const sync_pb::EntitySpecifics& specifics); // Unique client tag variant for adding items. sync_pb::SyncEntity* AddUpdatePref(const std::string& id, const std::string& parent_id, const std::string& client_tag, - int64 version, - int64 sync_ts); + int64_t version, + int64_t sync_ts); // Find the last commit sent by the client, and replay it for the next get // updates command. This can be used to simulate the GetUpdates that happens @@ -154,9 +156,9 @@ class MockConnectionManager : public ServerConnectionManager { void SetLastUpdateClientTag(const std::string& tag); void SetLastUpdateOriginatorFields(const std::string& client_id, const std::string& entry_id); - void SetLastUpdatePosition(int64 position_in_parent); + void SetLastUpdatePosition(int64_t position_in_parent); void SetNewTimestamp(int ts); - void SetChangesRemaining(int64 count); + void SetChangesRemaining(int64_t count); // Add a new batch of updates after the current one. Allows multiple // GetUpdates responses to be buffered up, since the syncer may @@ -275,20 +277,20 @@ class MockConnectionManager : public ServerConnectionManager { sync_pb::SyncEntity* AddUpdateFull(syncable::Id id, syncable::Id parentid, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir); sync_pb::SyncEntity* AddUpdateFull(const std::string& id, const std::string& parentid, const std::string& name, - int64 version, - int64 sync_ts, + int64_t version, + int64_t sync_ts, bool is_dir); sync_pb::SyncEntity* AddUpdateMeta(const std::string& id, const std::string& parentid, const std::string& name, - int64 version, - int64 sync_ts); + int64_t version, + int64_t sync_ts); // Functions to handle the various types of server request. void ProcessGetUpdates(sync_pb::ClientToServerMessage* csm, @@ -309,9 +311,7 @@ class MockConnectionManager : public ServerConnectionManager { // Generate a numeric position_in_parent value. We use a global counter // that only decreases; this simulates new objects always being added to the // front of the ordering. - int64 GeneratePositionInParent() { - return next_position_in_parent_--; - } + int64_t GeneratePositionInParent() { return next_position_in_parent_--; } // Get a mutable update response which will eventually be returned to the // client. @@ -398,7 +398,7 @@ class MockConnectionManager : public ServerConnectionManager { scoped_ptr<sync_pb::ClientCommand> commit_client_command_; // The next value to use for the position_in_parent property. - int64 next_position_in_parent_; + int64_t next_position_in_parent_; // The default is to use the newer sync_pb::BookmarkSpecifics-style protocol. // If this option is set to true, then the MockConnectionManager will diff --git a/sync/test/engine/mock_model_type_processor.cc b/sync/test/engine/mock_model_type_processor.cc index 8f2f947..d4249e2 100644 --- a/sync/test/engine/mock_model_type_processor.cc +++ b/sync/test/engine/mock_model_type_processor.cc @@ -4,6 +4,9 @@ #include "sync/test/engine/mock_model_type_processor.h" +#include <stddef.h> +#include <stdint.h> + #include "base/bind.h" #include "sync/engine/commit_queue.h" @@ -62,7 +65,7 @@ void MockModelTypeProcessor::RunQueuedTasks() { CommitRequestData MockModelTypeProcessor::CommitRequest( const std::string& tag_hash, const sync_pb::EntitySpecifics& specifics) { - const int64 base_version = GetBaseVersion(tag_hash); + const int64_t base_version = GetBaseVersion(tag_hash); EntityData data; @@ -90,7 +93,7 @@ CommitRequestData MockModelTypeProcessor::CommitRequest( CommitRequestData MockModelTypeProcessor::DeleteRequest( const std::string& tag_hash) { - const int64 base_version = GetBaseVersion(tag_hash); + const int64_t base_version = GetBaseVersion(tag_hash); EntityData data; @@ -218,9 +221,9 @@ void MockModelTypeProcessor::OnUpdateReceivedImpl( } // Fetches the sequence number as of the most recent update request. -int64 MockModelTypeProcessor::GetCurrentSequenceNumber( +int64_t MockModelTypeProcessor::GetCurrentSequenceNumber( const std::string& tag_hash) const { - std::map<const std::string, int64>::const_iterator it = + std::map<const std::string, int64_t>::const_iterator it = sequence_numbers_.find(tag_hash); if (it == sequence_numbers_.end()) { return 0; @@ -231,17 +234,17 @@ int64 MockModelTypeProcessor::GetCurrentSequenceNumber( // The model thread should be sending us items with strictly increasing // sequence numbers. Here's where we emulate that behavior. -int64 MockModelTypeProcessor::GetNextSequenceNumber( +int64_t MockModelTypeProcessor::GetNextSequenceNumber( const std::string& tag_hash) { - int64 sequence_number = GetCurrentSequenceNumber(tag_hash); + int64_t sequence_number = GetCurrentSequenceNumber(tag_hash); sequence_number++; sequence_numbers_[tag_hash] = sequence_number; return sequence_number; } -int64 MockModelTypeProcessor::GetBaseVersion( +int64_t MockModelTypeProcessor::GetBaseVersion( const std::string& tag_hash) const { - std::map<const std::string, int64>::const_iterator it = + std::map<const std::string, int64_t>::const_iterator it = base_versions_.find(tag_hash); if (it == base_versions_.end()) { return kUncommittedVersion; @@ -251,7 +254,7 @@ int64 MockModelTypeProcessor::GetBaseVersion( } void MockModelTypeProcessor::SetBaseVersion(const std::string& tag_hash, - int64 version) { + int64_t version) { base_versions_[tag_hash] = version; } diff --git a/sync/test/engine/mock_model_type_processor.h b/sync/test/engine/mock_model_type_processor.h index d926dfe..120dedc8 100644 --- a/sync/test/engine/mock_model_type_processor.h +++ b/sync/test/engine/mock_model_type_processor.h @@ -5,6 +5,9 @@ #ifndef SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_PROCESSOR_H_ #define SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_PROCESSOR_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> @@ -100,12 +103,12 @@ class MockModelTypeProcessor : public ModelTypeProcessor { const UpdateResponseDataList& pending_updates); // Getter and setter for per-item sequence number tracking. - int64 GetCurrentSequenceNumber(const std::string& tag_hash) const; - int64 GetNextSequenceNumber(const std::string& tag_hash); + int64_t GetCurrentSequenceNumber(const std::string& tag_hash) const; + int64_t GetNextSequenceNumber(const std::string& tag_hash); // Getter and setter for per-item base version tracking. - int64 GetBaseVersion(const std::string& tag_hash) const; - void SetBaseVersion(const std::string& tag_hash, int64 version); + int64_t GetBaseVersion(const std::string& tag_hash) const; + void SetBaseVersion(const std::string& tag_hash, int64_t version); // Getters and setter for server-assigned ID values. bool HasServerAssignedId(const std::string& tag_hash) const; @@ -130,8 +133,8 @@ class MockModelTypeProcessor : public ModelTypeProcessor { std::map<const std::string, UpdateResponseData> update_response_items_; // The per-item state maps. - std::map<const std::string, int64> sequence_numbers_; - std::map<const std::string, int64> base_versions_; + std::map<const std::string, int64_t> sequence_numbers_; + std::map<const std::string, int64_t> base_versions_; std::map<const std::string, std::string> assigned_ids_; DISALLOW_COPY_AND_ASSIGN(MockModelTypeProcessor); diff --git a/sync/test/engine/mock_nudge_handler.h b/sync/test/engine/mock_nudge_handler.h index 477d2bd..80d34ea 100644 --- a/sync/test/engine/mock_nudge_handler.h +++ b/sync/test/engine/mock_nudge_handler.h @@ -5,8 +5,8 @@ #ifndef SYNC_TEST_ENGINE_MOCK_NUDGE_HANDLER_H_ #define SYNC_TEST_ENGINE_MOCK_NUDGE_HANDLER_H_ -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "sync/engine/nudge_handler.h" #include "sync/internal_api/public/base/model_type.h" diff --git a/sync/test/engine/single_type_mock_server.cc b/sync/test/engine/single_type_mock_server.cc index 6f828fb..6c0b5cd 100644 --- a/sync/test/engine/single_type_mock_server.cc +++ b/sync/test/engine/single_type_mock_server.cc @@ -4,6 +4,9 @@ #include "sync/test/engine/single_type_mock_server.h" +#include <stddef.h> +#include <stdint.h> + #include "sync/util/time.h" using google::protobuf::RepeatedPtrField; @@ -33,11 +36,11 @@ sync_pb::SyncEntity SingleTypeMockServer::TypeRootUpdate() { } sync_pb::SyncEntity SingleTypeMockServer::UpdateFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash, const sync_pb::EntitySpecifics& specifics) { - int64 old_version = GetServerVersion(tag_hash); - int64 version = old_version + version_offset; + int64_t old_version = GetServerVersion(tag_hash); + int64_t version = old_version + version_offset; if (version > old_version) { SetServerVersion(tag_hash, version); } @@ -62,10 +65,10 @@ sync_pb::SyncEntity SingleTypeMockServer::UpdateFromServer( } sync_pb::SyncEntity SingleTypeMockServer::TombstoneFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash) { - int64 old_version = GetServerVersion(tag_hash); - int64 version = old_version + version_offset; + int64_t old_version = GetServerVersion(tag_hash); + int64_t version = old_version + version_offset; if (version > old_version) { SetServerVersion(tag_hash, version); } @@ -107,7 +110,7 @@ sync_pb::ClientToServerResponse SingleTypeMockServer::DoSuccessfulCommit( committed_items_[tag_hash] = *it; // Every commit increments the version number. - int64 version = GetServerVersion(tag_hash); + int64_t version = GetServerVersion(tag_hash); version++; SetServerVersion(tag_hash, version); @@ -159,9 +162,9 @@ std::string SingleTypeMockServer::GenerateId(const std::string& tag_hash) { return "FakeId:" + tag_hash; } -int64 SingleTypeMockServer::GetServerVersion( +int64_t SingleTypeMockServer::GetServerVersion( const std::string& tag_hash) const { - std::map<const std::string, int64>::const_iterator it; + std::map<const std::string, int64_t>::const_iterator it; it = server_versions_.find(tag_hash); // Server versions do not necessarily start at 1 or 0. if (it == server_versions_.end()) { @@ -172,7 +175,7 @@ int64 SingleTypeMockServer::GetServerVersion( } void SingleTypeMockServer::SetServerVersion(const std::string& tag_hash, - int64 version) { + int64_t version) { server_versions_[tag_hash] = version; } diff --git a/sync/test/engine/single_type_mock_server.h b/sync/test/engine/single_type_mock_server.h index 53ec575..ca1f5e3 100644 --- a/sync/test/engine/single_type_mock_server.h +++ b/sync/test/engine/single_type_mock_server.h @@ -5,10 +5,14 @@ #ifndef SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ #define SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ +#include <stddef.h> +#include <stdint.h> + #include <map> #include <string> #include <vector> +#include "base/macros.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/non_blocking_sync_common.h" @@ -35,13 +39,13 @@ class SingleTypeMockServer { // The |version_offset| parameter allows the caller to simulate reflected // updates, redeliveries, and genuine updates. sync_pb::SyncEntity UpdateFromServer( - int64 version_offset, + int64_t version_offset, const std::string& tag_hash, const sync_pb::EntitySpecifics& specifics); // Generates a SyncEntity representing a server-delivered update to delete // an item. - sync_pb::SyncEntity TombstoneFromServer(int64 version_offset, + sync_pb::SyncEntity TombstoneFromServer(int64_t version_offset, const std::string& tag_hash); // Generates a response to the specified commit message. @@ -74,14 +78,14 @@ class SingleTypeMockServer { static std::string GenerateId(const std::string& tag_hash); // Get and set our emulated server state. - int64 GetServerVersion(const std::string& tag_hash) const; - void SetServerVersion(const std::string& tag_hash, int64 version); + int64_t GetServerVersion(const std::string& tag_hash) const; + void SetServerVersion(const std::string& tag_hash, int64_t version); const ModelType type_; const std::string type_root_id_; // Server version state maps. - std::map<const std::string, int64> server_versions_; + std::map<const std::string, int64_t> server_versions_; // Log of messages sent to the server. std::vector<sync_pb::ClientToServerMessage> commit_messages_; diff --git a/sync/test/engine/test_directory_setter_upper.h b/sync/test/engine/test_directory_setter_upper.h index 587236a..72b4ee9 100644 --- a/sync/test/engine/test_directory_setter_upper.h +++ b/sync/test/engine/test_directory_setter_upper.h @@ -31,8 +31,8 @@ #include <string> -#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "sync/test/fake_sync_encryption_handler.h" #include "sync/test/null_directory_change_delegate.h" diff --git a/sync/test/engine/test_id_factory.h b/sync/test/engine/test_id_factory.h index 40a3b5b..705575a 100644 --- a/sync/test/engine/test_id_factory.h +++ b/sync/test/engine/test_id_factory.h @@ -7,6 +7,8 @@ #ifndef SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_ #define SYNC_TEST_ENGINE_TEST_ID_FACTORY_H_ +#include <stdint.h> + #include <string> #include "base/strings/string_number_conversions.h" @@ -26,7 +28,7 @@ class TestIdFactory { // If the number is positive, create a server ID based on the value. If // the number is negative, create a local ID based on the value. This // is deterministic, and [FromNumber(X) == FromNumber(Y)] iff [X == Y]. - static syncable::Id FromNumber(int64 value) { + static syncable::Id FromNumber(int64_t value) { if (value == 0) return root(); else if (value < 0) |