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

Unified Diff: chrome/browser/sync_file_system/local_file_sync_service_unittest.cc

Issue 11411352: Clear syncing flag after a remote or local sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: also check REMOTE_SERVICE_DISABLED state Created 8 years 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
Index: chrome/browser/sync_file_system/local_file_sync_service_unittest.cc
diff --git a/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc
index 27afc8c1422ae209fb194ce68e5dae84fef6fb9c..3e365c60b497af4674f22d50d551467b636664f9 100644
--- a/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local_file_sync_service_unittest.cc
@@ -314,13 +314,10 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) {
base::RunLoop run_loop;
- // We should get called OnSyncEnabled and OnWriteEnabled on kFile.
- // (We quit the run loop when OnWriteEnabled is called on kFile)
+ // We should get called OnSyncEnabled on kFile.
StrictMock<MockSyncStatusObserver> status_observer;
EXPECT_CALL(status_observer, OnSyncEnabled(kFile))
.Times(AtLeast(1));
- EXPECT_CALL(status_observer, OnWriteEnabled(kFile))
- .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and writes into a file.
@@ -353,7 +350,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) {
local_service_->ProcessLocalChange(
&local_change_processor,
- base::Bind(&OnSyncCompleted, FROM_HERE, base::Bind(&base::DoNothing),
+ base::Bind(&OnSyncCompleted, FROM_HERE, run_loop.QuitClosure(),
fileapi::SYNC_STATUS_OK, kFile));
run_loop.Run();
@@ -369,12 +366,9 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateAndRemoveFile) {
base::RunLoop run_loop;
// We should get called OnSyncEnabled and OnWriteEnabled on kFile.
- // (We quit the run loop when OnWriteEnabled is called on kFile)
StrictMock<MockSyncStatusObserver> status_observer;
EXPECT_CALL(status_observer, OnSyncEnabled(kFile))
.Times(AtLeast(1));
- EXPECT_CALL(status_observer, OnWriteEnabled(kFile))
- .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and then deletes a file.
@@ -394,7 +388,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateAndRemoveFile) {
// The sync should succeed anyway.
local_service_->ProcessLocalChange(
&local_change_processor,
- base::Bind(&OnSyncCompleted, FROM_HERE, base::Bind(&base::DoNothing),
+ base::Bind(&OnSyncCompleted, FROM_HERE, run_loop.QuitClosure(),
fileapi::SYNC_STATUS_OK, kFile));
run_loop.Run();
@@ -409,8 +403,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateAndRemoveDirectory) {
base::RunLoop run_loop;
- // OnSyncEnabled is expected to be called at least or more than once
- // but OnWriteEnabled will never be called.
+ // OnSyncEnabled is expected to be called at least or more than once.
StrictMock<MockSyncStatusObserver> status_observer;
EXPECT_CALL(status_observer, OnSyncEnabled(kDir)).Times(AtLeast(1));
file_system_->AddSyncStatusObserver(&status_observer);
@@ -442,12 +435,9 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_MultipleChanges) {
// We should get called OnSyncEnabled and OnWriteEnabled on kPath and
// OnSyncEnabled on kOther.
- // (We quit the run loop when OnWriteEnabled is called on kPath)
StrictMock<MockSyncStatusObserver> status_observer;
EXPECT_CALL(status_observer, OnSyncEnabled(kPath)).Times(AtLeast(1));
EXPECT_CALL(status_observer, OnSyncEnabled(kOther)).Times(AtLeast(1));
- EXPECT_CALL(status_observer, OnWriteEnabled(kPath))
- .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
file_system_->AddSyncStatusObserver(&status_observer);
// Creates a file, delete the file and creates a directory with the same
@@ -472,7 +462,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_MultipleChanges) {
local_service_->ProcessLocalChange(
&local_change_processor,
- base::Bind(&OnSyncCompleted, FROM_HERE, base::Bind(&base::DoNothing),
+ base::Bind(&OnSyncCompleted, FROM_HERE, run_loop.QuitClosure(),
fileapi::SYNC_STATUS_OK, kPath));
run_loop.Run();

Powered by Google App Engine
This is Rietveld 408576698