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

Side by Side Diff: chrome/browser/sync/profile_sync_service_bookmark_unittest.cc

Issue 11413153: Remove legacy GetURL(),SetURL(),GetFaviconBytes(),SetFaviconBytes() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.cc ('k') | sync/internal_api/base_node.cc » ('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 (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 <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 syncer::ReadNode predecessor(trans_); 86 syncer::ReadNode predecessor(trans_);
87 EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id)); 87 EXPECT_EQ(BaseNode::INIT_OK, predecessor.InitByIdLookup(predecessor_id));
88 EXPECT_EQ(predecessor.GetParentId(), parent.GetId()); 88 EXPECT_EQ(predecessor.GetParentId(), parent.GetId());
89 EXPECT_TRUE(node.InitByCreation(syncer::BOOKMARKS, parent, 89 EXPECT_TRUE(node.InitByCreation(syncer::BOOKMARKS, parent,
90 &predecessor)); 90 &predecessor));
91 } 91 }
92 EXPECT_EQ(node.GetPredecessorId(), predecessor_id); 92 EXPECT_EQ(node.GetPredecessorId(), predecessor_id);
93 EXPECT_EQ(node.GetParentId(), parent_id); 93 EXPECT_EQ(node.GetParentId(), parent_id);
94 node.SetIsFolder(is_folder); 94 node.SetIsFolder(is_folder);
95 node.SetTitle(title); 95 node.SetTitle(title);
96 if (!is_folder) 96 if (!is_folder) {
97 node.SetURL(GURL(url)); 97 sync_pb::BookmarkSpecifics specifics(node.GetBookmarkSpecifics());
98 specifics.set_url(url);
99 node.SetBookmarkSpecifics(specifics);
100 }
98 syncer::ChangeRecord record; 101 syncer::ChangeRecord record;
99 record.action = syncer::ChangeRecord::ACTION_ADD; 102 record.action = syncer::ChangeRecord::ACTION_ADD;
100 record.id = node.GetId(); 103 record.id = node.GetId();
101 changes_.push_back(record); 104 changes_.push_back(record);
102 return node.GetId(); 105 return node.GetId();
103 } 106 }
104 107
105 // Add a bookmark folder. 108 // Add a bookmark folder.
106 int64 AddFolder(const std::wstring& title, 109 int64 AddFolder(const std::wstring& title,
107 int64 parent_id, 110 int64 parent_id,
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ASSERT_TRUE(InitSyncNodeFromChromeNode(bnode, &gnode)); 451 ASSERT_TRUE(InitSyncNodeFromChromeNode(bnode, &gnode));
449 // Non-root node titles and parents must match. 452 // Non-root node titles and parents must match.
450 if (!model_->is_permanent_node(bnode)) { 453 if (!model_->is_permanent_node(bnode)) {
451 EXPECT_EQ(bnode->GetTitle(), UTF8ToUTF16(gnode.GetTitle())); 454 EXPECT_EQ(bnode->GetTitle(), UTF8ToUTF16(gnode.GetTitle()));
452 EXPECT_EQ( 455 EXPECT_EQ(
453 model_associator_->GetChromeNodeFromSyncId(gnode.GetParentId()), 456 model_associator_->GetChromeNodeFromSyncId(gnode.GetParentId()),
454 bnode->parent()); 457 bnode->parent());
455 } 458 }
456 EXPECT_EQ(bnode->is_folder(), gnode.GetIsFolder()); 459 EXPECT_EQ(bnode->is_folder(), gnode.GetIsFolder());
457 if (bnode->is_url()) 460 if (bnode->is_url())
458 EXPECT_EQ(bnode->url(), gnode.GetURL()); 461 EXPECT_EQ(bnode->url(), GURL(gnode.GetBookmarkSpecifics().url()));
459 462
460 // Check for position matches. 463 // Check for position matches.
461 int browser_index = bnode->parent()->GetIndexOf(bnode); 464 int browser_index = bnode->parent()->GetIndexOf(bnode);
462 if (browser_index == 0) { 465 if (browser_index == 0) {
463 EXPECT_EQ(gnode.GetPredecessorId(), 0); 466 EXPECT_EQ(gnode.GetPredecessorId(), 0);
464 } else { 467 } else {
465 const BookmarkNode* bprev = 468 const BookmarkNode* bprev =
466 bnode->parent()->GetChild(browser_index - 1); 469 bnode->parent()->GetChild(browser_index - 1);
467 syncer::ReadNode gprev(trans); 470 syncer::ReadNode gprev(trans);
468 ASSERT_TRUE(InitSyncNodeFromChromeNode(bprev, &gprev)); 471 ASSERT_TRUE(InitSyncNodeFromChromeNode(bprev, &gprev));
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 new_versions[changed_bookmark->id()]); 1746 new_versions[changed_bookmark->id()]);
1744 initial_versions.erase(changed_bookmark->id()); 1747 initial_versions.erase(changed_bookmark->id());
1745 ExpectTransactionVersionMatch(model_->bookmark_bar_node(), initial_versions); 1748 ExpectTransactionVersionMatch(model_->bookmark_bar_node(), initial_versions);
1746 ExpectTransactionVersionMatch(model_->other_node(), initial_versions); 1749 ExpectTransactionVersionMatch(model_->other_node(), initial_versions);
1747 ExpectTransactionVersionMatch(model_->mobile_node(), initial_versions); 1750 ExpectTransactionVersionMatch(model_->mobile_node(), initial_versions);
1748 } 1751 }
1749 1752
1750 } // namespace 1753 } // namespace
1751 1754
1752 } // namespace browser_sync 1755 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.cc ('k') | sync/internal_api/base_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698