summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 22:12:16 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 22:12:16 +0000
commitd061105e0b95444d1016b9a1b42cb87c6be599cf (patch)
tree9339309e1826c796446e029ca27f0bb676fdfbb8 /chrome
parent329ce1826c3dc7f5e7ac1079d4de8c00a09549ea (diff)
downloadchromium_src-d061105e0b95444d1016b9a1b42cb87c6be599cf.zip
chromium_src-d061105e0b95444d1016b9a1b42cb87c6be599cf.tar.gz
chromium_src-d061105e0b95444d1016b9a1b42cb87c6be599cf.tar.bz2
sync: fix test-only race in SyncerThread2Test.*Coalescing*
These tests would schedule a nudge in the future, and then two immediate ones in the hopes of hitting the coalesce code path. I switched it to use TestTimeouts and a longer delay, and only have two nudges. BUG=74663 TEST=SyncerThread2Test.*Coalescing* Review URL: http://codereview.chromium.org/6824055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/engine/syncer_thread2_unittest.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/sync/engine/syncer_thread2_unittest.cc b/chrome/browser/sync/engine/syncer_thread2_unittest.cc
index 02514677..22c72cd 100644
--- a/chrome/browser/sync/engine/syncer_thread2_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread2_unittest.cc
@@ -239,22 +239,20 @@ TEST_F(SyncerThread2Test, NudgeCoalescing) {
types1[syncable::BOOKMARKS] = true;
types2[syncable::AUTOFILL] = true;
types3[syncable::THEMES] = true;
- TimeDelta delay = TimeDelta::FromMilliseconds(20);
+ TimeDelta delay = TimeDelta::FromMilliseconds(
+ TestTimeouts::tiny_timeout_ms());
TimeTicks optimal_time = TimeTicks::Now() + delay;
syncer_thread()->ScheduleNudge(delay, NUDGE_SOURCE_UNKNOWN, types1,
FROM_HERE);
syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_LOCAL, types2,
FROM_HERE);
- syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_NOTIFICATION, types3,
- FROM_HERE);
done.TimedWait(timeout());
EXPECT_EQ(1U, r.snapshots.size());
EXPECT_GE(r.times[0], optimal_time);
EXPECT_TRUE(CompareModelTypeBitSetToModelTypePayloadMap(
- types1 | types2 | types3,
- r.snapshots[0]->source.types));
- EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION,
+ types1 | types2, r.snapshots[0]->source.types));
+ EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
r.snapshots[0]->source.updates_source);
SyncShareRecords r2;
@@ -321,14 +319,13 @@ TEST_F(SyncerThread2Test, NudgeWithPayloadsCoalescing) {
types1[syncable::BOOKMARKS] = "test1";
types2[syncable::AUTOFILL] = "test2";
types3[syncable::THEMES] = "test3";
- TimeDelta delay = TimeDelta::FromMilliseconds(20);
+ TimeDelta delay = TimeDelta::FromMilliseconds(
+ TestTimeouts::tiny_timeout_ms());
TimeTicks optimal_time = TimeTicks::Now() + delay;
syncer_thread()->ScheduleNudgeWithPayloads(delay, NUDGE_SOURCE_UNKNOWN,
types1, FROM_HERE);
syncer_thread()->ScheduleNudgeWithPayloads(zero(), NUDGE_SOURCE_LOCAL,
types2, FROM_HERE);
- syncer_thread()->ScheduleNudgeWithPayloads(zero(), NUDGE_SOURCE_NOTIFICATION,
- types3, FROM_HERE);
done.TimedWait(timeout());
EXPECT_EQ(1U, r.snapshots.size());
@@ -336,9 +333,8 @@ TEST_F(SyncerThread2Test, NudgeWithPayloadsCoalescing) {
syncable::ModelTypePayloadMap coalesced_types;
syncable::CoalescePayloads(&coalesced_types, types1);
syncable::CoalescePayloads(&coalesced_types, types2);
- syncable::CoalescePayloads(&coalesced_types, types3);
EXPECT_EQ(coalesced_types, r.snapshots[0]->source.types);
- EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION,
+ EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
r.snapshots[0]->source.updates_source);
SyncShareRecords r2;