| 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/single_thread_task_runner.h" |
| 10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 14 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 13 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 15 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 14 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" | 16 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" |
| 15 #include "chrome/browser/sync_file_system/local/mock_sync_status_observer.h" | 17 #include "chrome/browser/sync_file_system/local/mock_sync_status_observer.h" |
| 16 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 18 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 17 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" | 19 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
| 18 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 20 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
| 19 #include "chrome/browser/sync_file_system/sync_event_observer.h" | 21 #include "chrome/browser/sync_file_system/sync_event_observer.h" |
| 20 #include "chrome/browser/sync_file_system/sync_file_metadata.h" | 22 #include "chrome/browser/sync_file_system/sync_file_metadata.h" |
| 21 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 23 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void(const fileapi::FileSystemURL& url, | 94 void(const fileapi::FileSystemURL& url, |
| 93 SyncFileStatus status, | 95 SyncFileStatus status, |
| 94 SyncAction action, | 96 SyncAction action, |
| 95 SyncDirection direction)); | 97 SyncDirection direction)); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 ACTION_P3(NotifyStateAndCallback, | 100 ACTION_P3(NotifyStateAndCallback, |
| 99 mock_remote_service, service_state, operation_status) { | 101 mock_remote_service, service_state, operation_status) { |
| 100 mock_remote_service->NotifyRemoteServiceStateUpdated( | 102 mock_remote_service->NotifyRemoteServiceStateUpdated( |
| 101 service_state, "Test event."); | 103 service_state, "Test event."); |
| 102 base::MessageLoopProxy::current()->PostTask( | 104 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 103 FROM_HERE, base::Bind(arg1, operation_status)); | 105 FROM_HERE, base::Bind(arg1, operation_status)); |
| 104 } | 106 } |
| 105 | 107 |
| 106 ACTION_P(RecordState, states) { | 108 ACTION_P(RecordState, states) { |
| 107 states->push_back(arg1); | 109 states->push_back(arg1); |
| 108 } | 110 } |
| 109 | 111 |
| 110 ACTION_P(MockStatusCallback, status) { | 112 ACTION_P(MockStatusCallback, status) { |
| 111 base::MessageLoopProxy::current()->PostTask( | 113 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 112 FROM_HERE, base::Bind(arg4, status)); | 114 FROM_HERE, base::Bind(arg4, status)); |
| 113 } | 115 } |
| 114 | 116 |
| 115 ACTION_P2(MockSyncFileCallback, status, url) { | 117 ACTION_P2(MockSyncFileCallback, status, url) { |
| 116 base::MessageLoopProxy::current()->PostTask( | 118 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 117 FROM_HERE, base::Bind(arg0, status, url)); | 119 FROM_HERE, base::Bind(arg0, status, url)); |
| 118 } | 120 } |
| 119 | 121 |
| 120 class SyncFileSystemServiceTest : public testing::Test { | 122 class SyncFileSystemServiceTest : public testing::Test { |
| 121 protected: | 123 protected: |
| 122 SyncFileSystemServiceTest() | 124 SyncFileSystemServiceTest() |
| 123 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | | 125 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD | |
| 124 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} | 126 content::TestBrowserThreadBundle::REAL_IO_THREAD) {} |
| 125 | 127 |
| 126 virtual void SetUp() OVERRIDE { | 128 virtual void SetUp() OVERRIDE { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 base::Bind(&AssignValueAndQuit<SyncFileStatus>, | 466 base::Bind(&AssignValueAndQuit<SyncFileStatus>, |
| 465 &run_loop, &status, &sync_file_status)); | 467 &run_loop, &status, &sync_file_status)); |
| 466 run_loop.Run(); | 468 run_loop.Run(); |
| 467 | 469 |
| 468 EXPECT_EQ(SYNC_STATUS_OK, status); | 470 EXPECT_EQ(SYNC_STATUS_OK, status); |
| 469 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); | 471 EXPECT_EQ(SYNC_FILE_STATUS_HAS_PENDING_CHANGES, sync_file_status); |
| 470 } | 472 } |
| 471 } | 473 } |
| 472 | 474 |
| 473 } // namespace sync_file_system | 475 } // namespace sync_file_system |
| OLD | NEW |