OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(akalin): This file is basically just a unit test for | 5 // TODO(akalin): This file is basically just a unit test for |
6 // BookmarkChangeProcessor. Write unit tests for | 6 // BookmarkChangeProcessor. Write unit tests for |
7 // BookmarkModelAssociator separately. | 7 // BookmarkModelAssociator separately. |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 node.SetIsFolder(false); | 432 node.SetIsFolder(false); |
433 node.SetTitle(title); | 433 node.SetTitle(title); |
434 node.SetBookmarkSpecifics(specifics); | 434 node.SetBookmarkSpecifics(specifics); |
435 | 435 |
436 return node.GetId(); | 436 return node.GetId(); |
437 } | 437 } |
438 | 438 |
439 // Create a BookmarkModel. If |delete_bookmarks| is true, the bookmarks file | 439 // Create a BookmarkModel. If |delete_bookmarks| is true, the bookmarks file |
440 // will be deleted before starting up the BookmarkModel. | 440 // will be deleted before starting up the BookmarkModel. |
441 std::unique_ptr<BookmarkModel> CreateBookmarkModel(bool delete_bookmarks) { | 441 std::unique_ptr<BookmarkModel> CreateBookmarkModel(bool delete_bookmarks) { |
442 const base::FilePath& data_path = data_dir_.path(); | 442 const base::FilePath& data_path = data_dir_.GetPath(); |
443 auto model = base::MakeUnique<BookmarkModel>( | 443 auto model = base::MakeUnique<BookmarkModel>( |
444 base::WrapUnique(new bookmarks::TestBookmarkClient())); | 444 base::WrapUnique(new bookmarks::TestBookmarkClient())); |
445 managed_bookmark_service_->BookmarkModelCreated(model.get()); | 445 managed_bookmark_service_->BookmarkModelCreated(model.get()); |
446 int64_t next_id = 0; | 446 int64_t next_id = 0; |
447 static_cast<bookmarks::TestBookmarkClient*>(model->client()) | 447 static_cast<bookmarks::TestBookmarkClient*>(model->client()) |
448 ->SetExtraNodesToLoad( | 448 ->SetExtraNodesToLoad( |
449 managed_bookmark_service_->GetLoadExtraNodesCallback().Run( | 449 managed_bookmark_service_->GetLoadExtraNodesCallback().Run( |
450 &next_id)); | 450 &next_id)); |
451 if (delete_bookmarks) { | 451 if (delete_bookmarks) { |
452 base::DeleteFile(data_path.Append(FILE_PATH_LITERAL("dummy_bookmarks")), | 452 base::DeleteFile(data_path.Append(FILE_PATH_LITERAL("dummy_bookmarks")), |
(...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 EXPECT_EQ(syncer::kInvalidId, sync_id); | 2592 EXPECT_EQ(syncer::kInvalidId, sync_id); |
2593 | 2593 |
2594 // Verify that Sync ignores deleting this node. | 2594 // Verify that Sync ignores deleting this node. |
2595 model()->Remove(node); | 2595 model()->Remove(node); |
2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); | 2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); |
2597 } | 2597 } |
2598 | 2598 |
2599 } // namespace | 2599 } // namespace |
2600 | 2600 |
2601 } // namespace browser_sync | 2601 } // namespace browser_sync |
OLD | NEW |