Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: components/sync/test/fake_server/fake_server.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/test/fake_server/fake_server.cc
diff --git a/sync/test/fake_server/fake_server.cc b/components/sync/test/fake_server/fake_server.cc
similarity index 94%
rename from sync/test/fake_server/fake_server.cc
rename to components/sync/test/fake_server/fake_server.cc
index 969906682690210da9ac0050ee9da2253aee6adf..1bd66687dbec547afb0ee9d74f6367d58de6194c 100644
--- a/sync/test/fake_server/fake_server.cc
+++ b/components/sync/test/fake_server/fake_server.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/test/fake_server/fake_server.h"
+#include "components/sync/test/fake_server/fake_server.h"
#include <stdint.h>
@@ -21,14 +21,14 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
+#include "components/sync/base/model_type.h"
+#include "components/sync/protocol/sync.pb.h"
+#include "components/sync/test/fake_server/bookmark_entity.h"
+#include "components/sync/test/fake_server/permanent_entity.h"
+#include "components/sync/test/fake_server/tombstone_entity.h"
+#include "components/sync/test/fake_server/unique_client_entity.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/test/fake_server/bookmark_entity.h"
-#include "sync/test/fake_server/permanent_entity.h"
-#include "sync/test/fake_server/tombstone_entity.h"
-#include "sync/test/fake_server/unique_client_entity.h"
using std::string;
using std::vector;
@@ -52,7 +52,7 @@ static const char kBookmarkBarFolderServerTag[] = "bookmark_bar";
static const char kBookmarkBarFolderName[] = "Bookmark Bar";
// Properties of the other bookmarks permanent folder.
-static const char kOtherBookmarksFolderServerTag[] = "other_bookmarks";
+static const char kOtherBookmarksFolderServerTag[] = "other_bookmarks";
static const char kOtherBookmarksFolderName[] = "Other Bookmarks";
// Properties of the synced bookmarks permanent folder.
@@ -64,7 +64,7 @@ static const char kSyncedBookmarksFolderName[] = "Synced Bookmarks";
// GetUpdates call and an UpdateSieve instance.
class UpdateSieve {
public:
- ~UpdateSieve() { }
+ ~UpdateSieve() {}
// Factory method for creating an UpdateSieve.
static std::unique_ptr<UpdateSieve> Create(
@@ -143,8 +143,8 @@ std::unique_ptr<UpdateSieve> UpdateSieve::Create(
CHECK(parsed) << "Unable to parse progress marker token.";
}
- ModelType model_type = syncer::GetModelTypeFromSpecificsFieldNumber(
- marker.data_type_id());
+ ModelType model_type =
+ syncer::GetModelTypeFromSpecificsFieldNumber(marker.data_type_id());
request_from_version[model_type] = version;
if (version < min_version)
@@ -162,14 +162,15 @@ bool IsDeletedOrPermanent(const FakeServerEntity& entity) {
} // namespace
-FakeServer::FakeServer() : version_(0),
- store_birthday_(0),
- authenticated_(true),
- error_type_(sync_pb::SyncEnums::SUCCESS),
- alternate_triggered_errors_(false),
- request_counter_(0),
- network_enabled_(true),
- weak_ptr_factory_(this) {
+FakeServer::FakeServer()
+ : version_(0),
+ store_birthday_(0),
+ authenticated_(true),
+ error_type_(sync_pb::SyncEnums::SUCCESS),
+ alternate_triggered_errors_(false),
+ request_counter_(0),
+ network_enabled_(true),
+ weak_ptr_factory_(this) {
Init();
}
@@ -321,8 +322,7 @@ void FakeServer::HandleCommand(const string& request,
completion_closure.Run();
}
-bool FakeServer::GetLastCommitMessage(
- sync_pb::ClientToServerMessage* message) {
+bool FakeServer::GetLastCommitMessage(sync_pb::ClientToServerMessage* message) {
if (!last_commit_message_.has_commit())
return false;
@@ -365,13 +365,13 @@ bool FakeServer::HandleGetUpdatesRequest(
sync_pb::SyncEntity* response_entity = response->add_entries();
entity.SerializeAsProto(response_entity);
- max_response_version = std::max(max_response_version,
- response_entity->version());
+ max_response_version =
+ std::max(max_response_version, response_entity->version());
if (entity.GetModelType() == syncer::NIGORI) {
send_encryption_keys_based_on_nigori =
response_entity->specifics().nigori().passphrase_type() ==
- sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE;
+ sync_pb::NigoriSpecifics::KEYSTORE_PASSPHRASE;
}
}
}
@@ -495,8 +495,7 @@ bool FakeServer::HandleCommitRequest(const sync_pb::CommitMessage& commit,
sync_pb::SyncEntity client_entity = *it;
string parent_id = client_entity.parent_id_string();
- if (client_to_server_ids.find(parent_id) !=
- client_to_server_ids.end()) {
+ if (client_to_server_ids.find(parent_id) != client_to_server_ids.end()) {
parent_id = client_to_server_ids[parent_id];
}
@@ -713,8 +712,7 @@ std::string FakeServer::GetBookmarkBarFolderId() const {
for (EntityMap::const_iterator it = entities_.begin(); it != entities_.end();
++it) {
FakeServerEntity* entity = it->second.get();
- if (entity->GetName() == kBookmarkBarFolderName &&
- entity->IsFolder() &&
+ if (entity->GetName() == kBookmarkBarFolderName && entity->IsFolder() &&
entity->GetModelType() == syncer::BOOKMARKS) {
return entity->GetId();
}
« no previous file with comments | « components/sync/test/fake_server/fake_server.h ('k') | components/sync/test/fake_server/fake_server_entity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698