#include "components/sync/test/mock_connection_manager.h"
#include <map>
#include <utility>
#include "base/containers/contains.h"
#include "base/location.h"
#include "base/strings/stringprintf.h"
#include "base/uuid.h"
#include "components/sync/engine/syncer_proto_util.h"
#include "components/sync/protocol/bookmark_specifics.pb.h"
#include "components/sync/protocol/client_commands.pb.h"
#include "components/sync/protocol/data_type_progress_marker.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/protocol/sync_entity.pb.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
#include "testing/gtest/include/gtest/gtest.h"
map;
string;
ClientToServerMessage;
CommitMessage;
CommitResponse;
GetUpdatesMessage;
SyncEnums;
namespace syncer {
static char kValidAccessToken[] = …;
static char kCacheGuid[] = …;
MockConnectionManager::MockConnectionManager() { … }
MockConnectionManager::~MockConnectionManager() { … }
void MockConnectionManager::SetMidCommitCallback(base::OnceClosure callback) { … }
void MockConnectionManager::SetMidCommitObserver(
MockConnectionManager::MidCommitObserver* observer) { … }
HttpResponse MockConnectionManager::PostBuffer(const std::string& buffer_in,
const std::string& access_token,
std::string* buffer_out) { … }
sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { … }
void MockConnectionManager::AddDefaultBookmarkData(sync_pb::SyncEntity* entity,
bool is_folder) { … }
void MockConnectionManager::SetGUClientCommand(
std::unique_ptr<sync_pb::ClientCommand> command) { … }
void MockConnectionManager::SetCommitClientCommand(
std::unique_ptr<sync_pb::ClientCommand> command) { … }
void MockConnectionManager::SetTransientErrorId(const std::string& id) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateSpecifics(
const std::string& id,
const std::string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts,
bool is_dir,
const sync_pb::EntitySpecifics& specifics) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateSpecifics(
const std::string& id,
const std::string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts,
bool is_dir,
const sync_pb::EntitySpecifics& specifics,
const string& originator_cache_guid,
const string& originator_client_item_id) { … }
sync_pb::SyncEntity* MockConnectionManager::SetNigori(
const std::string& id,
int64_t version,
int64_t sync_ts,
const sync_pb::EntitySpecifics& specifics) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdatePref(
const string& id,
const string& parent_id,
const string& client_tag,
int64_t version,
int64_t sync_ts) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateFull(
const string& id,
const string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts,
bool is_dir) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateMeta(
const string& id,
const string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory(
const string& id,
const string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts,
const std::string& originator_cache_guid,
const std::string& originator_client_item_id) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateBookmark(
const string& id,
const string& parent_id,
const string& name,
int64_t version,
int64_t sync_ts,
const string& originator_cache_guid,
const string& originator_client_item_id) { … }
sync_pb::SyncEntity* MockConnectionManager::AddUpdateFromLastCommit() { … }
void MockConnectionManager::AddUpdateTombstone(const std::string& id,
DataType type) { … }
void MockConnectionManager::SetLastUpdateDeleted() { … }
void MockConnectionManager::SetLastUpdateOriginatorFields(
const string& client_id,
const string& entry_id) { … }
void MockConnectionManager::SetLastUpdateServerTag(const string& tag) { … }
void MockConnectionManager::SetLastUpdateClientTag(const string& tag) { … }
void MockConnectionManager::SetNewTimestamp(int ts) { … }
sync_pb::DataTypeProgressMarker*
MockConnectionManager::AddUpdateProgressMarker() { … }
void MockConnectionManager::ApplyToken() { … }
void MockConnectionManager::SetChangesRemaining(int64_t timestamp) { … }
bool MockConnectionManager::ProcessGetUpdates(
sync_pb::ClientToServerMessage* csm,
sync_pb::ClientToServerResponse* response) { … }
void MockConnectionManager::SetKeystoreKey(const std::string& key) { … }
bool MockConnectionManager::ShouldConflictThisCommit() { … }
bool MockConnectionManager::ShouldTransientErrorThisId(const std::string& id) { … }
bool MockConnectionManager::ProcessCommit(
sync_pb::ClientToServerMessage* csm,
sync_pb::ClientToServerResponse* response_buffer) { … }
bool MockConnectionManager::ProcessClearServerData(
sync_pb::ClientToServerMessage* csm,
sync_pb::ClientToServerResponse* response) { … }
sync_pb::SyncEntity* MockConnectionManager::GetMutableLastUpdate() { … }
void MockConnectionManager::NextUpdateBatch() { … }
const CommitMessage& MockConnectionManager::last_sent_commit() const { … }
const CommitResponse& MockConnectionManager::last_commit_response() const { … }
const sync_pb::ClientToServerMessage& MockConnectionManager::last_request()
const { … }
const std::vector<sync_pb::ClientToServerMessage>&
MockConnectionManager::requests() const { … }
bool MockConnectionManager::IsDataTypePresentInSpecifics(
const google::protobuf::RepeatedPtrField<sync_pb::DataTypeProgressMarker>&
filter,
DataType value) { … }
sync_pb::DataTypeProgressMarker const*
MockConnectionManager::GetProgressMarkerForType(
const google::protobuf::RepeatedPtrField<sync_pb::DataTypeProgressMarker>&
filter,
DataType value) { … }
void MockConnectionManager::SetServerReachable() { … }
void MockConnectionManager::SetServerNotReachable() { … }
void MockConnectionManager::UpdateConnectionStatus() { … }
}