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

Unified Diff: chrome/browser/sync/profile_sync_service_bookmark_unittest.cc

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
index 5974e36b44ab25dac07a4dcb492e3f6f3abeb954..305353fb7c6079532854da66f3e572737b159426 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -1046,13 +1046,12 @@ TEST_F(ProfileSyncServiceBookmarkTest, BookmarkModelOperations) {
// Test deletion.
// Delete a single item.
- model_->Remove(url2->parent(), url2->parent()->GetIndexOf(url2));
+ model_->Remove(url2);
ExpectModelMatch();
// Delete an item with several children.
- model_->Remove(folder2->parent(),
- folder2->parent()->GetIndexOf(folder2));
+ model_->Remove(folder2);
ExpectModelMatch();
- model_->Remove(model_->mobile_node(), 0);
+ model_->Remove(model_->mobile_node()->GetChild(0));
ExpectModelMatch();
}
@@ -1923,12 +1922,12 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeModelsWithSomeExtras) {
const BookmarkNode* child_node = bookmark_bar_node->GetChild(remove_index);
ASSERT_TRUE(child_node);
ASSERT_TRUE(child_node->is_url());
- model_->Remove(bookmark_bar_node, remove_index);
+ model_->Remove(bookmark_bar_node->GetChild(remove_index));
ASSERT_GT(bookmark_bar_node->child_count(), remove_index);
child_node = bookmark_bar_node->GetChild(remove_index);
ASSERT_TRUE(child_node);
ASSERT_TRUE(child_node->is_folder());
- model_->Remove(bookmark_bar_node, remove_index);
+ model_->Remove(bookmark_bar_node->GetChild(remove_index));
const BookmarkNode* other_node = model_->other_node();
ASSERT_GE(other_node->child_count(), 1);
@@ -1937,9 +1936,9 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeModelsWithSomeExtras) {
ASSERT_TRUE(f3_node->is_folder());
remove_index = 2;
ASSERT_GT(f3_node->child_count(), remove_index);
- model_->Remove(f3_node, remove_index);
+ model_->Remove(f3_node->GetChild(remove_index));
ASSERT_GT(f3_node->child_count(), remove_index);
- model_->Remove(f3_node, remove_index);
+ model_->Remove(f3_node->GetChild(remove_index));
StartSync();
ExpectModelMatch();
@@ -1956,12 +1955,12 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeModelsWithSomeExtras) {
child_node = bookmark_bar_node->GetChild(remove_index);
ASSERT_TRUE(child_node);
ASSERT_TRUE(child_node->is_url());
- model_->Remove(bookmark_bar_node, remove_index);
+ model_->Remove(bookmark_bar_node->GetChild(remove_index));
ASSERT_GT(bookmark_bar_node->child_count(), remove_index);
child_node = bookmark_bar_node->GetChild(remove_index);
ASSERT_TRUE(child_node);
ASSERT_TRUE(child_node->is_folder());
- model_->Remove(bookmark_bar_node, remove_index);
+ model_->Remove(bookmark_bar_node->GetChild(remove_index));
ASSERT_GE(bookmark_bar_node->child_count(), 2);
model_->Move(bookmark_bar_node->GetChild(0), bookmark_bar_node, 1);
@@ -1973,9 +1972,9 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, MergeModelsWithSomeExtras) {
ASSERT_TRUE(f3_node->is_folder());
remove_index = 0;
ASSERT_GT(f3_node->child_count(), remove_index);
- model_->Remove(f3_node, remove_index);
+ model_->Remove(f3_node->GetChild(remove_index));
ASSERT_GT(f3_node->child_count(), remove_index);
- model_->Remove(f3_node, remove_index);
+ model_->Remove(f3_node->GetChild(remove_index));
ASSERT_GE(other_node->child_count(), 4);
model_->Move(other_node->GetChild(0), other_node, 1);
@@ -2339,7 +2338,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateTransactionVersion) {
// Verify model version is incremented and bookmark node versions remain
// the same.
const BookmarkNode* bookmark_bar = model_->bookmark_bar_node();
- model_->Remove(bookmark_bar, 0);
+ model_->Remove(bookmark_bar->GetChild(0));
base::MessageLoop::current()->RunUntilIdle();
BookmarkNodeVersionMap new_versions;
GetTransactionVersions(model_->root_node(), &new_versions);
« no previous file with comments | « chrome/browser/sync/glue/bookmark_model_associator.cc ('k') | chrome/browser/sync/test/integration/bookmarks_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698