diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:17:48 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:17:48 +0000 |
commit | 368f3a7502802277d24d219c2ed0fdac09f36470 (patch) | |
tree | bd877d741c470fa411a53710b3b2f06cc5fa5ae0 /chrome/browser/sync | |
parent | 39529b33b5e80e5be1d583dfd43f0d692209cbf3 (diff) | |
download | chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.zip chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.tar.gz chromium_src-368f3a7502802277d24d219c2ed0fdac09f36470.tar.bz2 |
Rename IndexOfChild to GetIndexOf. Part 1
This is part of a serie of patches to make the TreeNode more closer to style
used in the Views Tree API (see views/view.h for reference).
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6623037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77295 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/glue/bookmark_change_processor.cc | 12 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_unittest.cc | 22 |
2 files changed, 17 insertions, 17 deletions
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index ad673ef..316fb3d 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/glue/bookmark_change_processor.h" @@ -107,7 +107,7 @@ void BookmarkChangeProcessor::RemoveSyncNodeHierarchy( int index = 0; while (node) { // The top of |index_stack| should always be |node|'s index. - DCHECK(!node->GetParent() || (node->GetParent()->IndexOfChild(node) == + DCHECK(!node->GetParent() || (node->GetParent()->GetIndexOf(node) == index_stack.top())); if (index == node->GetChildCount()) { // If we've processed all of |node|'s children, delete |node| and move @@ -214,7 +214,7 @@ void BookmarkChangeProcessor::BookmarkNodeChanged(BookmarkModel* model, sync_node.GetParentId()), node->GetParent()); // This node's index should be one more than the predecessor's index. - DCHECK_EQ(node->GetParent()->IndexOfChild(node), + DCHECK_EQ(node->GetParent()->GetIndexOf(node), CalculateBookmarkModelInsertionIndex(node->GetParent(), &sync_node)); } @@ -343,7 +343,7 @@ int BookmarkChangeProcessor::CalculateBookmarkModelInsertionIndex( model_associator_->GetChromeNodeFromSyncId(predecessor_id); DCHECK(predecessor); DCHECK_EQ(predecessor->GetParent(), parent); - return parent->IndexOfChild(predecessor) + 1; + return parent->GetIndexOf(predecessor) + 1; } // ApplyModelChanges is called by the sync backend after changes have been made @@ -410,7 +410,7 @@ void BookmarkChangeProcessor::ApplyChangesFromSyncModel( } DCHECK_EQ(dst->GetChildCount(), 0) << "Node being deleted has children"; model_associator_->Disassociate(changes[i].id); - model->Remove(parent, parent->IndexOfChild(dst)); + model->Remove(parent, parent->GetIndexOf(dst)); dst = NULL; } else { DCHECK_EQ((changes[i].action == @@ -432,7 +432,7 @@ void BookmarkChangeProcessor::ApplyChangesFromSyncModel( // There should be no nodes left under the foster parent. DCHECK_EQ(foster_parent->GetChildCount(), 0); model->Remove(foster_parent->GetParent(), - foster_parent->GetParent()->IndexOfChild(foster_parent)); + foster_parent->GetParent()->GetIndexOf(foster_parent)); foster_parent = NULL; } diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 5226715..07c0ceb 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -1,17 +1,16 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <stack> #include <vector> -#include "testing/gtest/include/gtest/gtest.h" #include "base/file_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/string16.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" @@ -20,10 +19,10 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/engine/syncapi.h" -#include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/bookmark_change_processor.h" #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" #include "chrome/browser/sync/glue/bookmark_model_associator.h" +#include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/model_associator.h" #include "chrome/browser/sync/glue/sync_backend_host.h" @@ -32,14 +31,15 @@ #include "chrome/browser/sync/js_test_util.h" #include "chrome/browser/sync/profile_sync_factory.h" #include "chrome/browser/sync/profile_sync_factory_mock.h" -#include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/browser/sync/profile_sync_test_util.h" +#include "chrome/browser/sync/test_profile_sync_service.h" #include "chrome/common/net/gaia/gaia_constants.h" #include "chrome/common/pref_names.h" -#include "chrome/test/testing_profile.h" #include "chrome/test/testing_pref_service.h" +#include "chrome/test/testing_profile.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" using std::vector; using browser_sync::AssociatorInterface; @@ -392,7 +392,7 @@ class ProfileSyncServiceTest : public testing::Test { EXPECT_EQ(bnode->GetURL(), gnode.GetURL()); // Check for position matches. - int browser_index = bnode->GetParent()->IndexOfChild(bnode); + int browser_index = bnode->GetParent()->GetIndexOf(bnode); if (browser_index == 0) { EXPECT_EQ(gnode.GetPredecessorId(), 0); } else { @@ -479,8 +479,8 @@ class ProfileSyncServiceTest : public testing::Test { void ExpectModelMatch(sync_api::BaseTransaction* trans) { const BookmarkNode* root = model_->root_node(); - EXPECT_EQ(root->IndexOfChild(model_->GetBookmarkBarNode()), 0); - EXPECT_EQ(root->IndexOfChild(model_->other_node()), 1); + EXPECT_EQ(root->GetIndexOf(model_->GetBookmarkBarNode()), 0); + EXPECT_EQ(root->GetIndexOf(model_->other_node()), 1); std::stack<int64> stack; stack.push(bookmark_bar_id()); @@ -613,11 +613,11 @@ TEST_F(ProfileSyncServiceTest, BookmarkModelOperations) { // Test deletion. // Delete a single item. - model_->Remove(url2->GetParent(), url2->GetParent()->IndexOfChild(url2)); + model_->Remove(url2->GetParent(), url2->GetParent()->GetIndexOf(url2)); ExpectModelMatch(); // Delete an item with several children. model_->Remove(folder2->GetParent(), - folder2->GetParent()->IndexOfChild(folder2)); + folder2->GetParent()->GetIndexOf(folder2)); ExpectModelMatch(); } |