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

Unified Diff: chrome/browser/sync/engine/syncer_thread_unittest.cc

Issue 2991003: Fix race condition in test Pause method. (Closed)
Patch Set: Reenable test. Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncer_thread_unittest.cc
diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc
index a9798ade4f175f9160ef27866a1f04a4e81b37f4..5f22076b04bc72a2e69d3de21791de5d0810cf50 100644
--- a/chrome/browser/sync/engine/syncer_thread_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc
@@ -6,6 +6,7 @@
#include <map>
#include <set>
+#include "base/lock.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "base/waitable_event.h"
@@ -116,9 +117,12 @@ class SyncerThreadWithSyncerTest : public testing::Test,
bool Pause(ListenerMock* listener) {
WaitableEvent event(false, false);
- EXPECT_CALL(*listener, HandleChannelEvent(
- Field(&SyncerEvent::what_happened, SyncerEvent::PAUSED))).
- WillOnce(SignalEvent(&event));
+ {
+ AutoLock lock(syncer_thread()->lock_);
+ EXPECT_CALL(*listener, HandleChannelEvent(
+ Field(&SyncerEvent::what_happened, SyncerEvent::PAUSED))).
+ WillOnce(SignalEvent(&event));
+ }
if (!syncer_thread()->RequestPause())
return false;
return event.TimedWait(max_wait_time_);
@@ -126,9 +130,12 @@ class SyncerThreadWithSyncerTest : public testing::Test,
bool Resume(ListenerMock* listener) {
WaitableEvent event(false, false);
- EXPECT_CALL(*listener, HandleChannelEvent(
- Field(&SyncerEvent::what_happened, SyncerEvent::RESUMED))).
- WillOnce(SignalEvent(&event));
+ {
+ AutoLock lock(syncer_thread()->lock_);
+ EXPECT_CALL(*listener, HandleChannelEvent(
+ Field(&SyncerEvent::what_happened, SyncerEvent::RESUMED))).
+ WillOnce(SignalEvent(&event));
+ }
if (!syncer_thread()->RequestResume())
return false;
return event.TimedWait(max_wait_time_);
@@ -800,15 +807,7 @@ TEST_F(SyncerThreadWithSyncerTest, AuthInvalid) {
// I have been unable to reproduce this hang after extensive testing
// on a local Windows machine so these tests will remain flaky in
// order to help diagnose the problem.
-// oshima: this is actually crashing and cause failure on XP Tests.
-// Disabling on windows.
-// This issue is tracked at http://crbug.com/39070.
-#if defined(OS_WIN)
-#define MAYBE_Pause DISABLED_Pause
-#else
-#define MAYBE_Pause Pause
-#endif
-TEST_F(SyncerThreadWithSyncerTest, MAYBE_Pause) {
+TEST_F(SyncerThreadWithSyncerTest, FLAKY_Pause) {
WaitableEvent sync_cycle_ended_event(false, false);
WaitableEvent paused_event(false, false);
WaitableEvent resumed_event(false, false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698