summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/syncable/syncable_unittest.cc
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 18:36:21 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-02 18:36:21 +0000
commit932a7c831a73253afe68d8368e74f71ae0101e4e (patch)
tree88339c4bf1a4d7acbf287b52a0ecd0ff4388232e /chrome/browser/sync/syncable/syncable_unittest.cc
parent64688e49023269bc2cde0d7890dccf665c1195c2 (diff)
downloadchromium_src-932a7c831a73253afe68d8368e74f71ae0101e4e.zip
chromium_src-932a7c831a73253afe68d8368e74f71ae0101e4e.tar.gz
chromium_src-932a7c831a73253afe68d8368e74f71ae0101e4e.tar.bz2
[Sync] Make syncer commands avoid posting tasks on threads with no work to do
Add abstract GetGroupsToChange() method to ModelChangingSyncerCommand. Use that to figure out which worker threads to post work on (instead of posting on all of them). Implement GetGroupsToChange() for each ModelChangingSyncerCommand. Add GetEnabledGroups() and GetEnabledGroupsWithConflicts() functions to SyncSession. Key unapplied updates index by type for ApplyUpdatesCommand. Make the abstract methods of ModelChangingSyncerCommand protected. This patch includes a speculative fix for the perf regression introduced by the last time this was landed (112178). BUG=97832 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=112178 Review URL: http://codereview.chromium.org/8637006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/syncable/syncable_unittest.cc')
-rw-r--r--chrome/browser/sync/syncable/syncable_unittest.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc
index 1b6fc38..b7fcb6e 100644
--- a/chrome/browser/sync/syncable/syncable_unittest.cc
+++ b/chrome/browser/sync/syncable/syncable_unittest.cc
@@ -47,8 +47,8 @@ TEST_F(SyncableKernelTest, ToValue) {
if (value.get()) {
// Not much to check without repeating the ToValue() code.
EXPECT_TRUE(value->HasKey("isDirty"));
- // The extra +1 is for "isDirty".
- EXPECT_EQ(BIT_TEMPS_END - BEGIN_FIELDS + 1,
+ // The extra +2 is for "isDirty" and "serverModelType".
+ EXPECT_EQ(BIT_TEMPS_END - BEGIN_FIELDS + 2,
static_cast<int>(value->size()));
} else {
ADD_FAILURE();
@@ -370,7 +370,6 @@ TEST_F(SyncableGeneralTest, ToValue) {
scoped_ptr<DictionaryValue> value(me.ToValue());
ExpectDictBooleanValue(true, *value, "good");
EXPECT_TRUE(value->HasKey("kernel"));
- ExpectDictStringValue("Unspecified", *value, "serverModelType");
ExpectDictStringValue("Unspecified", *value, "modelType");
ExpectDictBooleanValue(true, *value, "existsOnClientBecauseNameIsNonEmpty");
ExpectDictBooleanValue(false, *value, "isRoot");
@@ -880,10 +879,12 @@ TEST_F(SyncableDirectoryTest, TestGetUnsynced) {
TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) {
Directory::UnappliedUpdateMetaHandles handles;
int64 handle1, handle2;
+ syncable::ModelTypeBitSet all_types;
+ all_types.set();
{
WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get());
- dir_->GetUnappliedUpdateMetaHandles(&trans, &handles);
+ dir_->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles);
ASSERT_TRUE(0 == handles.size());
MutableEntry e1(&trans, CREATE, trans.root_id(), "abba");
@@ -905,7 +906,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) {
{
WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get());
- dir_->GetUnappliedUpdateMetaHandles(&trans, &handles);
+ dir_->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles);
ASSERT_TRUE(0 == handles.size());
MutableEntry e3(&trans, GET_BY_HANDLE, handle1);
@@ -915,7 +916,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) {
dir_->SaveChanges();
{
WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get());
- dir_->GetUnappliedUpdateMetaHandles(&trans, &handles);
+ dir_->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles);
ASSERT_TRUE(1 == handles.size());
ASSERT_TRUE(handle1 == handles[0]);
@@ -926,7 +927,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) {
dir_->SaveChanges();
{
WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get());
- dir_->GetUnappliedUpdateMetaHandles(&trans, &handles);
+ dir_->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles);
ASSERT_TRUE(2 == handles.size());
if (handle1 == handles[0]) {
ASSERT_TRUE(handle2 == handles[1]);
@@ -942,7 +943,7 @@ TEST_F(SyncableDirectoryTest, TestGetUnappliedUpdates) {
dir_->SaveChanges();
{
WriteTransaction trans(FROM_HERE, UNITTEST, dir_.get());
- dir_->GetUnappliedUpdateMetaHandles(&trans, &handles);
+ dir_->GetUnappliedUpdateMetaHandles(&trans, all_types, &handles);
ASSERT_TRUE(1 == handles.size());
ASSERT_TRUE(handle2 == handles[0]);
}