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

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

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. 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
52 scoped_ptr<FakeServerEntity> BookmarkEntityBuilder::Build() { 48 scoped_ptr<FakeServerEntity> BookmarkEntityBuilder::Build() {
53 if (!url_.is_valid()) { 49 if (!url_.is_valid()) {
54 return make_scoped_ptr<FakeServerEntity>(NULL); 50 return make_scoped_ptr<FakeServerEntity>(NULL);
55 } 51 }
56 52
57 sync_pb::EntitySpecifics entity_specifics; 53 sync_pb::EntitySpecifics entity_specifics;
58 sync_pb::BookmarkSpecifics* bookmark_specifics = 54 sync_pb::BookmarkSpecifics* bookmark_specifics =
59 entity_specifics.mutable_bookmark(); 55 entity_specifics.mutable_bookmark();
60 bookmark_specifics->set_title(name_); 56 bookmark_specifics->set_title(name_);
61 bookmark_specifics->set_url(url_.spec()); 57 bookmark_specifics->set_url(url_.spec());
62 58
63 sync_pb::UniquePosition unique_position; 59 sync_pb::UniquePosition unique_position;
64 // TODO(pvalenzuela): Allow caller customization of the position integer. 60 // TODO(pvalenzuela): Allow caller customization of the position integer.
65 string suffix = GenerateSyncableBookmarkHash(originator_cache_guid_, 61 string suffix = GenerateSyncableBookmarkHash(originator_cache_guid_,
66 originator_client_item_id_); 62 originator_client_item_id_);
67 syncer::UniquePosition::FromInt64(0, suffix).ToProto(&unique_position); 63 syncer::UniquePosition::FromInt64(0, suffix).ToProto(&unique_position);
68 64
69 if (parent_id_.empty()) {
70 parent_id_ = FakeServerEntity::CreateId(syncer::BOOKMARKS, "bookmark_bar");
71 }
72
73 return make_scoped_ptr<FakeServerEntity>( 65 return make_scoped_ptr<FakeServerEntity>(
74 new BookmarkEntity(id_, 66 new BookmarkEntity(id_,
75 kUnusedVersion, 67 kUnusedVersion,
76 name_, 68 name_,
77 originator_cache_guid_, 69 originator_cache_guid_,
78 originator_client_item_id_, 70 originator_client_item_id_,
79 unique_position, 71 unique_position,
80 entity_specifics, 72 entity_specifics,
81 // TODO(pvalenzuela): Support bookmark folders. 73 // TODO(pvalenzuela): Support bookmark folders.
82 false, 74 false,
83 parent_id_, 75 // TODO(pvalenzuela): Support caller specification of
76 // the parent bookmark folder.
77 FakeServerEntity::CreateId(syncer::BOOKMARKS,
78 "bookmark_bar"),
84 kDefaultTime, 79 kDefaultTime,
85 kDefaultTime)); 80 kDefaultTime));
86 } 81 }
87 82
88 } // namespace fake_server 83 } // 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