OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/sync_file_system/drive_backend/sync_engine.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 *status = itr->second; | 90 *status = itr->second; |
91 // If an origin is uninstalled, it should not be found actually. | 91 // If an origin is uninstalled, it should not be found actually. |
92 if (*status == "Uninstalled") | 92 if (*status == "Uninstalled") |
93 return false; | 93 return false; |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 void PostUpdateServiceState(RemoteServiceState state, | 97 void PostUpdateServiceState(RemoteServiceState state, |
98 const std::string& description) { | 98 const std::string& description) { |
99 worker_task_runner_->PostTask( | 99 worker_task_runner_->PostTask( |
100 FROM_HERE, | 100 FROM_HERE, base::BindOnce(&FakeSyncWorker::UpdateServiceState, |
101 base::Bind(&FakeSyncWorker::UpdateServiceState, | 101 base::Unretained(fake_sync_worker()), state, |
102 base::Unretained(fake_sync_worker()), | 102 description)); |
103 state, | |
104 description)); | |
105 WaitForWorkerTaskRunner(); | 103 WaitForWorkerTaskRunner(); |
106 } | 104 } |
107 | 105 |
108 void WaitForWorkerTaskRunner() { | 106 void WaitForWorkerTaskRunner() { |
109 DCHECK(worker_task_runner_.get()); | 107 DCHECK(worker_task_runner_.get()); |
110 | 108 |
111 base::RunLoop run_loop; | 109 base::RunLoop run_loop; |
112 worker_task_runner_->PostTask( | 110 worker_task_runner_->PostTask( |
113 FROM_HERE, | 111 FROM_HERE, |
114 RelayCallbackToCurrentThread( | 112 RelayCallbackToCurrentThread( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 TEST_F(SyncEngineTest, ProcessRemoteChange) { | 225 TEST_F(SyncEngineTest, ProcessRemoteChange) { |
228 SyncStatusCode sync_status; | 226 SyncStatusCode sync_status; |
229 storage::FileSystemURL url; | 227 storage::FileSystemURL url; |
230 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); | 228 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); |
231 WaitForWorkerTaskRunner(); | 229 WaitForWorkerTaskRunner(); |
232 EXPECT_EQ(SYNC_STATUS_OK, sync_status); | 230 EXPECT_EQ(SYNC_STATUS_OK, sync_status); |
233 } | 231 } |
234 | 232 |
235 } // namespace drive_backend | 233 } // namespace drive_backend |
236 } // namespace sync_file_system | 234 } // namespace sync_file_system |
OLD | NEW |