| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_worker.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_worker.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/drive/drive_uploader.h" | 13 #include "chrome/browser/drive/drive_uploader.h" |
| 12 #include "chrome/browser/drive/fake_drive_service.h" | 14 #include "chrome/browser/drive/fake_drive_service.h" |
| 13 #include "chrome/browser/extensions/test_extension_service.h" | 15 #include "chrome/browser/extensions/test_extension_service.h" |
| 14 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 16 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
| 15 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" | 17 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.pb.h" |
| 16 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 18 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
| 17 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" | 19 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" |
| 18 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 20 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
| 19 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 21 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
| 20 #include "content/public/test/test_browser_thread_bundle.h" | 22 #include "content/public/test/test_browser_thread_bundle.h" |
| 21 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 22 #include "extensions/common/extension_builder.h" | 24 #include "extensions/common/extension_builder.h" |
| 23 #include "extensions/common/extension_set.h" | 25 #include "extensions/common/extension_set.h" |
| 24 #include "extensions/common/value_builder.h" | 26 #include "extensions/common/value_builder.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 26 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 28 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 27 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 29 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 28 | 30 |
| 29 namespace sync_file_system { | 31 namespace sync_file_system { |
| 30 namespace drive_backend { | 32 namespace drive_backend { |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 const char kAppID[] = "app_id"; | 36 const char kAppID[] = "app_id"; |
| 35 | 37 |
| 36 void EmptyTask(SyncStatusCode status, const SyncStatusCallback& callback) { | 38 void EmptyTask(SyncStatusCode status, const SyncStatusCallback& callback) { |
| 37 base::MessageLoop::current()->PostTask( | 39 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 38 FROM_HERE, base::Bind(callback, status)); | 40 base::Bind(callback, status)); |
| 39 } | 41 } |
| 40 | 42 |
| 41 } // namespace | 43 } // namespace |
| 42 | 44 |
| 43 class MockSyncTask : public ExclusiveTask { | 45 class MockSyncTask : public ExclusiveTask { |
| 44 public: | 46 public: |
| 45 explicit MockSyncTask(bool used_network) { | 47 explicit MockSyncTask(bool used_network) { |
| 46 set_used_network(used_network); | 48 set_used_network(used_network); |
| 47 } | 49 } |
| 48 ~MockSyncTask() override {} | 50 ~MockSyncTask() override {} |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 base::Bind(&SyncWorkerTest::CheckServiceState, | 379 base::Bind(&SyncWorkerTest::CheckServiceState, |
| 378 AsWeakPtr(), | 380 AsWeakPtr(), |
| 379 SYNC_STATUS_OK, | 381 SYNC_STATUS_OK, |
| 380 REMOTE_SERVICE_OK)); | 382 REMOTE_SERVICE_OK)); |
| 381 | 383 |
| 382 base::RunLoop().RunUntilIdle(); | 384 base::RunLoop().RunUntilIdle(); |
| 383 } | 385 } |
| 384 | 386 |
| 385 } // namespace drive_backend | 387 } // namespace drive_backend |
| 386 } // namespace sync_file_system | 388 } // namespace sync_file_system |
| OLD | NEW |