OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 SYNC_STATUS_FAILED); | 291 SYNC_STATUS_FAILED); |
292 } | 292 } |
293 | 293 |
294 // Flaky. http://crbug.com/237710 | 294 // Flaky. http://crbug.com/237710 |
295 TEST_F(SyncFileSystemServiceTest, DISABLED_SimpleLocalSyncFlow) { | 295 TEST_F(SyncFileSystemServiceTest, DISABLED_SimpleLocalSyncFlow) { |
296 InitializeApp(); | 296 InitializeApp(); |
297 | 297 |
298 StrictMock<MockSyncStatusObserver> status_observer; | 298 StrictMock<MockSyncStatusObserver> status_observer; |
299 | 299 |
300 EnableSync(); | 300 EnableSync(); |
301 file_system_->file_system_context()->sync_context()-> | 301 |
| 302 file_system_->mount_provider()->sync_context()-> |
302 set_mock_notify_changes_duration_in_sec(0); | 303 set_mock_notify_changes_duration_in_sec(0); |
303 file_system_->AddSyncStatusObserver(&status_observer); | 304 file_system_->AddSyncStatusObserver(&status_observer); |
304 | 305 |
305 // We'll test one local sync for this file. | 306 // We'll test one local sync for this file. |
306 const FileSystemURL kFile(file_system_->URL("foo")); | 307 const FileSystemURL kFile(file_system_->URL("foo")); |
307 | 308 |
308 base::RunLoop run_loop; | 309 base::RunLoop run_loop; |
309 | 310 |
310 // We should get called OnSyncEnabled and OnWriteEnabled on kFile. | 311 // We should get called OnSyncEnabled and OnWriteEnabled on kFile. |
311 // (We quit the run loop when OnWriteEnabled is called on kFile) | 312 // (We quit the run loop when OnWriteEnabled is called on kFile) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // This should trigger a remote sync. | 350 // This should trigger a remote sync. |
350 mock_remote_service()->NotifyRemoteChangeQueueUpdated(1); | 351 mock_remote_service()->NotifyRemoteChangeQueueUpdated(1); |
351 | 352 |
352 run_loop.Run(); | 353 run_loop.Run(); |
353 } | 354 } |
354 | 355 |
355 TEST_F(SyncFileSystemServiceTest, SimpleSyncFlowWithFileBusy) { | 356 TEST_F(SyncFileSystemServiceTest, SimpleSyncFlowWithFileBusy) { |
356 InitializeApp(); | 357 InitializeApp(); |
357 | 358 |
358 EnableSync(); | 359 EnableSync(); |
359 file_system_->file_system_context()->sync_context()-> | 360 |
| 361 file_system_->mount_provider()->sync_context()-> |
360 set_mock_notify_changes_duration_in_sec(0); | 362 set_mock_notify_changes_duration_in_sec(0); |
361 | 363 |
362 const FileSystemURL kFile(file_system_->URL("foo")); | 364 const FileSystemURL kFile(file_system_->URL("foo")); |
363 | 365 |
364 base::RunLoop run_loop; | 366 base::RunLoop run_loop; |
365 | 367 |
366 // We expect a set of method calls for starting a remote sync. | 368 // We expect a set of method calls for starting a remote sync. |
367 EXPECT_CALL(*mock_remote_service(), GetCurrentState()) | 369 EXPECT_CALL(*mock_remote_service(), GetCurrentState()) |
368 .Times(AtLeast(3)) | 370 .Times(AtLeast(3)) |
369 .WillRepeatedly(Return(REMOTE_SERVICE_OK)); | 371 .WillRepeatedly(Return(REMOTE_SERVICE_OK)); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 base::Bind(&AssignValueAndQuit<SyncFileStatus>, | 487 base::Bind(&AssignValueAndQuit<SyncFileStatus>, |
486 &run_loop, &status, &sync_file_status)); | 488 &run_loop, &status, &sync_file_status)); |
487 run_loop.Run(); | 489 run_loop.Run(); |
488 | 490 |
489 EXPECT_EQ(SYNC_STATUS_OK, status); | 491 EXPECT_EQ(SYNC_STATUS_OK, status); |
490 EXPECT_EQ(SYNC_FILE_STATUS_CONFLICTING, sync_file_status); | 492 EXPECT_EQ(SYNC_FILE_STATUS_CONFLICTING, sync_file_status); |
491 } | 493 } |
492 } | 494 } |
493 | 495 |
494 } // namespace sync_file_system | 496 } // namespace sync_file_system |
OLD | NEW |