summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 19:58:53 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 19:58:53 +0000
commitb9bc572542b8fba83dd35594dd05cccc8419c6ff (patch)
tree8c09d1675831594b1d1e938b3a62085a1aeb2ba8
parentfa989b6f5a9f85ef427760ca6acff296ad86f196 (diff)
downloadchromium_src-b9bc572542b8fba83dd35594dd05cccc8419c6ff.zip
chromium_src-b9bc572542b8fba83dd35594dd05cccc8419c6ff.tar.gz
chromium_src-b9bc572542b8fba83dd35594dd05cccc8419c6ff.tar.bz2
Sync: Fix RequestResume in SyncerThread, and re-enable the various unit tests
that were breaking. BUG=62880,39070,62880 TEST=sync_unit_tests Review URL: http://codereview.chromium.org/5047002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66507 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/syncer_thread.cc3
-rw-r--r--chrome/browser/sync/engine/syncer_thread_unittest.cc24
2 files changed, 11 insertions, 16 deletions
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc
index 765c1f1..f5c2f80 100644
--- a/chrome/browser/sync/engine/syncer_thread.cc
+++ b/chrome/browser/sync/engine/syncer_thread.cc
@@ -16,7 +16,6 @@
#include <queue>
#include "base/rand_util.h"
-#include "base/stringprintf.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/engine/net/server_connection_manager.h"
@@ -204,6 +203,8 @@ bool SyncerThread::RequestResume() {
if (vault_.pause_requested_) {
// If pause was requested we have not yet paused. In this case,
// the resume cancels the pause request.
+ vault_.pause_requested_ = false;
+ vault_field_changed_.Broadcast();
Notify(SyncEngineEvent::SYNCER_THREAD_RESUMED);
VLOG(1) << "Pending pause canceled by resume.";
} else {
diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc
index 1ef38d0..b2238eb 100644
--- a/chrome/browser/sync/engine/syncer_thread_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc
@@ -697,11 +697,7 @@ TEST_F(SyncerThreadWithSyncerTest, Nudge) {
EXPECT_TRUE(syncer_thread()->Stop(2000));
}
-
-
-// Disabled (Bug 62880).
-// TODO(zea): Fix RequestPause/RequestResume and get this working.
-TEST_F(SyncerThreadWithSyncerTest, DISABLED_NudgeWithDataTypes) {
+TEST_F(SyncerThreadWithSyncerTest, NudgeWithDataTypes) {
SyncShareIntercept interceptor;
connection()->SetMidCommitObserver(&interceptor);
// We don't want a poll to happen during this test (except the first one).
@@ -711,17 +707,22 @@ TEST_F(SyncerThreadWithSyncerTest, DISABLED_NudgeWithDataTypes) {
syncer_thread()->CreateSyncer(metadb()->name());
const TimeDelta poll_interval = TimeDelta::FromMinutes(5);
interceptor.WaitForSyncShare(1, poll_interval + poll_interval);
-
EXPECT_EQ(static_cast<unsigned int>(1),
interceptor.times_sync_occured().size());
+
// The SyncerThread should be waiting for the poll now. Nudge it to sync
// immediately (5ms).
syncable::ModelTypeBitSet model_types;
model_types[syncable::BOOKMARKS] = true;
+
+ // Paused so we can verify the nudge types safely.
+ syncer_thread()->RequestPause();
syncer_thread()->NudgeSyncerWithDataTypes(5,
SyncerThread::kUnknown,
model_types);
EXPECT_EQ(model_types, syncer_thread()->vault_.pending_nudge_types_);
+ syncer_thread()->RequestResume();
+
interceptor.WaitForSyncShare(1, TimeDelta::FromSeconds(1));
EXPECT_EQ(static_cast<unsigned int>(2),
interceptor.times_sync_occured().size());
@@ -846,11 +847,7 @@ TEST_F(SyncerThreadWithSyncerTest, AuthInvalid) {
EXPECT_TRUE(syncer_thread()->Stop(2000));
}
-// TODO(skrul): The "Pause" and "PauseWhenNotConnected" tests are
-// marked DISABLED because they sometimes fail on the Windows buildbots.
-// I have been unable to reproduce this hang after extensive testing
-// on a local Windows machine.
-TEST_F(SyncerThreadWithSyncerTest, DISABLED_Pause) {
+TEST_F(SyncerThreadWithSyncerTest, Pause) {
WaitableEvent sync_cycle_ended_event(false, false);
WaitableEvent paused_event(false, false);
WaitableEvent resumed_event(false, false);
@@ -955,10 +952,7 @@ TEST_F(SyncerThreadWithSyncerTest, StartWhenNotConnected) {
EXPECT_TRUE(syncer_thread()->Stop(2000));
}
-// TODO(skrul): See TODO comment on the "Pause" test above for an
-// explanation of the usage of DISABLED here.
-// TODO(pinkerton): disabled due to hanging on test bots http://crbug.com/39070
-TEST_F(SyncerThreadWithSyncerTest, DISABLED_PauseWhenNotConnected) {
+TEST_F(SyncerThreadWithSyncerTest, PauseWhenNotConnected) {
WaitableEvent sync_cycle_ended_event(false, false);
WaitableEvent event(false, false);
ListenerMock listener;