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
3 // found in the LICENSE file.
5 #ifndef SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_BUILDER_H_
6 #define SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_BUILDER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "sync/internal_api/public/base/model_type.h"
12 #include "sync/test/fake_server/fake_server_entity.h"
15 namespace fake_server
{
17 // Builder for BookmarkEntity objects.
18 class BookmarkEntityBuilder
{
20 BookmarkEntityBuilder(const std::string
& title
,
21 const std::string
& originator_cache_guid
,
22 const std::string
& originator_client_item_id
);
24 ~BookmarkEntityBuilder();
26 // Sets the parent ID of the bookmark to be built. If this is not called,
27 // the bookmark will be included in the bookmarks bar.
28 void SetParentId(const std::string
& parent_id
);
30 // Builds and returns a FakeServerEntity representing a bookmark. Returns null
31 // if the entity could not be built.
32 scoped_ptr
<FakeServerEntity
> BuildBookmark(const GURL
& url
);
34 // Builds and returns a FakeServerEntity representing a bookmark folder.
35 // Returns null if the entity could not be built.
36 scoped_ptr
<FakeServerEntity
> BuildFolder();
39 // Creates an EntitySpecifics and pre-populates its BookmarkSpecifics with
40 // the entity's title.
41 sync_pb::EntitySpecifics
CreateBaseEntitySpecifics() const;
43 // Builds the parts of a FakeServerEntity common to both normal bookmarks and
45 scoped_ptr
<FakeServerEntity
> Build(
46 const sync_pb::EntitySpecifics
& entity_specifics
,
49 // The bookmark entity's title. This value is also used as the entity's name.
50 const std::string title_
;
52 // Information that associates the bookmark with its original client.
53 const std::string originator_cache_guid_
;
54 const std::string originator_client_item_id_
;
56 // The ID of the parent bookmark folder.
57 std::string parent_id_
;
60 } // namespace fake_server
62 #endif // SYNC_TEST_FAKE_SERVER_BOOKMARK_ENTITY_BUILDER_H_