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

Unified Diff: sync/test/fake_server/bookmark_entity_builder.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
« no previous file with comments | « sync/test/fake_server/bookmark_entity_builder.h ('k') | sync/test/fake_server/entity_builder_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/fake_server/bookmark_entity_builder.cc
diff --git a/sync/test/fake_server/bookmark_entity_builder.cc b/sync/test/fake_server/bookmark_entity_builder.cc
deleted file mode 100644
index 5b9aee01db4b14c3c686f1ff3db1c467e5bce138..0000000000000000000000000000000000000000
--- a/sync/test/fake_server/bookmark_entity_builder.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// 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/bookmark_entity_builder.h"
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "base/guid.h"
-#include "base/memory/ptr_util.h"
-#include "base/time/time.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/base/unique_position.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/syncable/syncable_util.h"
-#include "sync/test/fake_server/bookmark_entity.h"
-#include "sync/test/fake_server/fake_server_entity.h"
-#include "sync/util/time.h"
-#include "url/gurl.h"
-
-using std::string;
-
-using syncer::syncable::GenerateSyncableBookmarkHash;
-
-// A version must be passed when creating a FakeServerEntity, but this value
-// is overrideen immediately when saving the entity in FakeServer.
-const int64_t kUnusedVersion = 0L;
-
-// Default time (creation and last modified) used when creating entities.
-const int64_t kDefaultTime = 1234L;
-
-namespace fake_server {
-
-BookmarkEntityBuilder::BookmarkEntityBuilder(
- const string& title,
- const string& originator_cache_guid,
- const string& originator_client_item_id)
- : title_(title),
- originator_cache_guid_(originator_cache_guid),
- originator_client_item_id_(originator_client_item_id) {
-}
-
-BookmarkEntityBuilder::BookmarkEntityBuilder(
- const BookmarkEntityBuilder& other) = default;
-
-BookmarkEntityBuilder::~BookmarkEntityBuilder() {
-}
-
-void BookmarkEntityBuilder::SetParentId(const std::string& parent_id) {
- parent_id_ = parent_id;
-}
-
-std::unique_ptr<FakeServerEntity> BookmarkEntityBuilder::BuildBookmark(
- const GURL& url) {
- if (!url.is_valid()) {
- return base::WrapUnique<FakeServerEntity>(NULL);
- }
-
- sync_pb::EntitySpecifics entity_specifics = CreateBaseEntitySpecifics();
- entity_specifics.mutable_bookmark()->set_url(url.spec());
- const bool kIsNotFolder = false;
- return Build(entity_specifics, kIsNotFolder);
-}
-
-std::unique_ptr<FakeServerEntity> BookmarkEntityBuilder::BuildFolder() {
- const bool kIsFolder = true;
- return Build(CreateBaseEntitySpecifics(), kIsFolder);
-}
-
-sync_pb::EntitySpecifics BookmarkEntityBuilder::CreateBaseEntitySpecifics()
- const {
- sync_pb::EntitySpecifics entity_specifics;
- sync_pb::BookmarkSpecifics* bookmark_specifics =
- entity_specifics.mutable_bookmark();
- bookmark_specifics->set_title(title_);
-
- return entity_specifics;
-}
-
-std::unique_ptr<FakeServerEntity> BookmarkEntityBuilder::Build(
- const sync_pb::EntitySpecifics& entity_specifics,
- bool is_folder) {
- sync_pb::UniquePosition unique_position;
- // TODO(pvalenzuela): Allow caller customization of the position integer.
- const string suffix = GenerateSyncableBookmarkHash(
- originator_cache_guid_,
- originator_client_item_id_);
- syncer::UniquePosition::FromInt64(0, suffix).ToProto(&unique_position);
-
- if (parent_id_.empty()) {
- parent_id_ = FakeServerEntity::CreateId(syncer::BOOKMARKS, "bookmark_bar");
- }
-
- const string id = FakeServerEntity::CreateId(syncer::BOOKMARKS,
- base::GenerateGUID());
-
- return base::WrapUnique<FakeServerEntity>(new BookmarkEntity(
- id, kUnusedVersion, title_, originator_cache_guid_,
- originator_client_item_id_, unique_position, entity_specifics, is_folder,
- parent_id_, kDefaultTime, kDefaultTime));
-}
-
-} // namespace fake_server
« no previous file with comments | « sync/test/fake_server/bookmark_entity_builder.h ('k') | sync/test/fake_server/entity_builder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698