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

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

Issue 23578026: Use SNAPSHOT sync mode for LocalSync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased on thread_bundle fix Created 7 years, 3 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
Index: chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
index 499ea67cbf9ed2004713d079053abe584a537e80..035e03c6046dad9ca50781bf9b5ab0ee3bdce216 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc
@@ -321,10 +321,12 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) {
base::RunLoop run_loop;
- // We should get called OnSyncEnabled on kFile.
+ // We should get called OnSyncEnabled and OnWriteEnabled on kFile.
+ // (OnWriteEnabled is called because we release lock before returning
+ // from ApplyLocalChange)
StrictMock<MockSyncStatusObserver> status_observer;
- EXPECT_CALL(status_observer, OnSyncEnabled(kFile))
- .Times(AtLeast(1));
+ EXPECT_CALL(status_observer, OnSyncEnabled(kFile)).Times(AtLeast(1));
+ EXPECT_CALL(status_observer, OnWriteEnabled(kFile)).Times(AtLeast(1));
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and writes into a file.
@@ -332,7 +334,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) {
EXPECT_EQ(kTestFileDataSize,
file_system_->WriteString(kFile, std::string(kTestFileData)));
- // Retrieve the expected platform_path.
+ // Retrieve the expected file info.
base::PlatformFileInfo info;
base::FilePath platform_path;
EXPECT_EQ(base::PLATFORM_FILE_OK,
@@ -353,7 +355,7 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateFile) {
const FileChange change(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
SYNC_FILE_TYPE_FILE);
EXPECT_CALL(local_change_processor,
- ApplyLocalChange(change, platform_path, metadata, kFile, _))
+ ApplyLocalChange(change, _, metadata, kFile, _))
.WillOnce(MockStatusCallback(SYNC_STATUS_OK));
local_service_->SetLocalChangeProcessor(&local_change_processor);
@@ -375,8 +377,8 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_CreateAndRemoveFile) {
// We should get called OnSyncEnabled and OnWriteEnabled on kFile.
StrictMock<MockSyncStatusObserver> status_observer;
- EXPECT_CALL(status_observer, OnSyncEnabled(kFile))
- .Times(AtLeast(1));
+ EXPECT_CALL(status_observer, OnSyncEnabled(kFile)).Times(AtLeast(1));
+ EXPECT_CALL(status_observer, OnWriteEnabled(kFile)).Times(AtLeast(1));
file_system_->AddSyncStatusObserver(&status_observer);
// Creates and then deletes a file.
@@ -465,6 +467,10 @@ TEST_F(LocalFileSyncServiceTest, ProcessLocalChange_MultipleChanges) {
.WillOnce(MockStatusCallbackAndRecordChange(SYNC_STATUS_OK, &changes))
.WillOnce(MockStatusCallbackAndRecordChange(SYNC_STATUS_OK, &changes));
local_service_->SetLocalChangeProcessor(&local_change_processor);
+
+ // OnWriteEnabled will be notified on kPath.
+ EXPECT_CALL(status_observer, OnWriteEnabled(kPath)).Times(AtLeast(1));
+
local_service_->ProcessLocalChange(
base::Bind(&OnSyncCompleted, FROM_HERE, run_loop.QuitClosure(),
SYNC_STATUS_OK, kPath));

Powered by Google App Engine
This is Rietveld 408576698