| 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 "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 struct { | 212 struct { |
| 213 RemoteServiceState state; | 213 RemoteServiceState state; |
| 214 const char* description; | 214 const char* description; |
| 215 } test_data[] = { | 215 } test_data[] = { |
| 216 {REMOTE_SERVICE_OK, "OK"}, | 216 {REMOTE_SERVICE_OK, "OK"}, |
| 217 {REMOTE_SERVICE_TEMPORARY_UNAVAILABLE, "TEMPORARY_UNAVAILABLE"}, | 217 {REMOTE_SERVICE_TEMPORARY_UNAVAILABLE, "TEMPORARY_UNAVAILABLE"}, |
| 218 {REMOTE_SERVICE_AUTHENTICATION_REQUIRED, "AUTHENTICATION_REQUIRED"}, | 218 {REMOTE_SERVICE_AUTHENTICATION_REQUIRED, "AUTHENTICATION_REQUIRED"}, |
| 219 {REMOTE_SERVICE_DISABLED, "DISABLED"}, | 219 {REMOTE_SERVICE_DISABLED, "DISABLED"}, |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 222 for (size_t i = 0; i < arraysize(test_data); ++i) { |
| 223 PostUpdateServiceState(test_data[i].state, test_data[i].description); | 223 PostUpdateServiceState(test_data[i].state, test_data[i].description); |
| 224 EXPECT_EQ(test_data[i].state, sync_engine()->GetCurrentState()) | 224 EXPECT_EQ(test_data[i].state, sync_engine()->GetCurrentState()) |
| 225 << "Expected state: REMOTE_SERVICE_" << test_data[i].description; | 225 << "Expected state: REMOTE_SERVICE_" << test_data[i].description; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 TEST_F(SyncEngineTest, ProcessRemoteChange) { | 229 TEST_F(SyncEngineTest, ProcessRemoteChange) { |
| 230 SyncStatusCode sync_status; | 230 SyncStatusCode sync_status; |
| 231 storage::FileSystemURL url; | 231 storage::FileSystemURL url; |
| 232 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); | 232 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); |
| 233 WaitForWorkerTaskRunner(); | 233 WaitForWorkerTaskRunner(); |
| 234 EXPECT_EQ(SYNC_STATUS_OK, sync_status); | 234 EXPECT_EQ(SYNC_STATUS_OK, sync_status); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace drive_backend | 237 } // namespace drive_backend |
| 238 } // namespace sync_file_system | 238 } // namespace sync_file_system |
| OLD | NEW |