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

Side by Side Diff: sync/test/fake_server/bookmark_entity_builder.cc

Issue 1094553002: Revert "Speculative revert by sheriff" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « sync/test/fake_server/bookmark_entity_builder.h ('k') | sync/test/fake_server/fake_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/test/fake_server/bookmark_entity_builder.h" 5 #include "sync/test/fake_server/bookmark_entity_builder.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 27 matching lines...) Expand all
38 const string& originator_client_item_id) 38 const string& originator_client_item_id)
39 : EntityBuilder(syncer::BOOKMARKS, title), 39 : EntityBuilder(syncer::BOOKMARKS, title),
40 url_(url), 40 url_(url),
41 originator_cache_guid_(originator_cache_guid), 41 originator_cache_guid_(originator_cache_guid),
42 originator_client_item_id_(originator_client_item_id) { 42 originator_client_item_id_(originator_client_item_id) {
43 } 43 }
44 44
45 BookmarkEntityBuilder::~BookmarkEntityBuilder() { 45 BookmarkEntityBuilder::~BookmarkEntityBuilder() {
46 } 46 }
47 47
48 void BookmarkEntityBuilder::SetParentId(const std::string& parent_id) {
49 parent_id_ = parent_id;
50 }
51
48 scoped_ptr<FakeServerEntity> BookmarkEntityBuilder::Build() { 52 scoped_ptr<FakeServerEntity> BookmarkEntityBuilder::Build() {
49 if (!url_.is_valid()) { 53 if (!url_.is_valid()) {
50 return make_scoped_ptr<FakeServerEntity>(NULL); 54 return make_scoped_ptr<FakeServerEntity>(NULL);
51 } 55 }
52 56
53 sync_pb::EntitySpecifics entity_specifics; 57 sync_pb::EntitySpecifics entity_specifics;
54 sync_pb::BookmarkSpecifics* bookmark_specifics = 58 sync_pb::BookmarkSpecifics* bookmark_specifics =
55 entity_specifics.mutable_bookmark(); 59 entity_specifics.mutable_bookmark();
56 bookmark_specifics->set_title(name_); 60 bookmark_specifics->set_title(name_);
57 bookmark_specifics->set_url(url_.spec()); 61 bookmark_specifics->set_url(url_.spec());
58 62
59 sync_pb::UniquePosition unique_position; 63 sync_pb::UniquePosition unique_position;
60 // TODO(pvalenzuela): Allow caller customization of the position integer. 64 // TODO(pvalenzuela): Allow caller customization of the position integer.
61 string suffix = GenerateSyncableBookmarkHash(originator_cache_guid_, 65 string suffix = GenerateSyncableBookmarkHash(originator_cache_guid_,
62 originator_client_item_id_); 66 originator_client_item_id_);
63 syncer::UniquePosition::FromInt64(0, suffix).ToProto(&unique_position); 67 syncer::UniquePosition::FromInt64(0, suffix).ToProto(&unique_position);
64 68
69 if (parent_id_.empty()) {
70 parent_id_ = FakeServerEntity::CreateId(syncer::BOOKMARKS, "bookmark_bar");
71 }
72
65 return make_scoped_ptr<FakeServerEntity>( 73 return make_scoped_ptr<FakeServerEntity>(
66 new BookmarkEntity(id_, 74 new BookmarkEntity(id_,
67 kUnusedVersion, 75 kUnusedVersion,
68 name_, 76 name_,
69 originator_cache_guid_, 77 originator_cache_guid_,
70 originator_client_item_id_, 78 originator_client_item_id_,
71 unique_position, 79 unique_position,
72 entity_specifics, 80 entity_specifics,
73 // TODO(pvalenzuela): Support bookmark folders. 81 // TODO(pvalenzuela): Support bookmark folders.
74 false, 82 false,
75 // TODO(pvalenzuela): Support caller specification of 83 parent_id_,
76 // the parent bookmark folder.
77 FakeServerEntity::CreateId(syncer::BOOKMARKS,
78 "bookmark_bar"),
79 kDefaultTime, 84 kDefaultTime,
80 kDefaultTime)); 85 kDefaultTime));
81 } 86 }
82 87
83 } // namespace fake_server 88 } // namespace fake_server
OLDNEW
« no previous file with comments | « sync/test/fake_server/bookmark_entity_builder.h ('k') | sync/test/fake_server/fake_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698