| 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/local/syncable_file_operation_runner.h
" |
| 6 |
| 5 #include <stddef.h> | 7 #include <stddef.h> |
| 6 #include <stdint.h> | 8 #include <stdint.h> |
| 7 | 9 |
| 10 #include <memory> |
| 8 #include <string> | 11 #include <string> |
| 9 | 12 |
| 10 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 11 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 12 #include "base/location.h" | 15 #include "base/location.h" |
| 13 #include "base/macros.h" | 16 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 16 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 17 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
| 18 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 20 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 19 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 21 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 20 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 22 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 21 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 23 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
| 22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 24 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 23 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" | |
| 24 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" | 25 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" |
| 25 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 26 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 26 #include "content/public/test/mock_blob_url_request_context.h" | 27 #include "content/public/test/mock_blob_url_request_context.h" |
| 27 #include "content/public/test/test_browser_thread_bundle.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
| 28 #include "storage/browser/fileapi/file_system_context.h" | 29 #include "storage/browser/fileapi/file_system_context.h" |
| 29 #include "storage/browser/fileapi/file_system_operation_runner.h" | 30 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 32 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 32 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 33 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 33 | 34 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::MessageLoop::current()->QuitWhenIdle(); | 141 base::MessageLoop::current()->QuitWhenIdle(); |
| 141 } | 142 } |
| 142 | 143 |
| 143 bool CreateTempFile(base::FilePath* path) { | 144 bool CreateTempFile(base::FilePath* path) { |
| 144 return base::CreateTemporaryFileInDir(dir_.path(), path); | 145 return base::CreateTemporaryFileInDir(dir_.path(), path); |
| 145 } | 146 } |
| 146 | 147 |
| 147 content::TestBrowserThreadBundle thread_bundle_; | 148 content::TestBrowserThreadBundle thread_bundle_; |
| 148 | 149 |
| 149 base::ScopedTempDir dir_; | 150 base::ScopedTempDir dir_; |
| 150 scoped_ptr<leveldb::Env> in_memory_env_; | 151 std::unique_ptr<leveldb::Env> in_memory_env_; |
| 151 | 152 |
| 152 CannedSyncableFileSystem file_system_; | 153 CannedSyncableFileSystem file_system_; |
| 153 scoped_refptr<LocalFileSyncContext> sync_context_; | 154 scoped_refptr<LocalFileSyncContext> sync_context_; |
| 154 | 155 |
| 155 int callback_count_; | 156 int callback_count_; |
| 156 File::Error write_status_; | 157 File::Error write_status_; |
| 157 size_t write_bytes_; | 158 size_t write_bytes_; |
| 158 bool write_complete_; | 159 bool write_complete_; |
| 159 | 160 |
| 160 MockBlobURLRequestContext url_request_context_; | 161 MockBlobURLRequestContext url_request_context_; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 storage::FileSystemOperationRunner::OperationID id = | 408 storage::FileSystemOperationRunner::OperationID id = |
| 408 file_system_.operation_runner()->Truncate( | 409 file_system_.operation_runner()->Truncate( |
| 409 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); | 410 URL(kFile), 10, ExpectStatus(FROM_HERE, File::FILE_OK)); |
| 410 file_system_.operation_runner()->Cancel( | 411 file_system_.operation_runner()->Cancel( |
| 411 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); | 412 id, ExpectStatus(FROM_HERE, File::FILE_ERROR_INVALID_OPERATION)); |
| 412 base::RunLoop().Run(); | 413 base::RunLoop().Run(); |
| 413 EXPECT_EQ(2, callback_count_); | 414 EXPECT_EQ(2, callback_count_); |
| 414 } | 415 } |
| 415 | 416 |
| 416 } // namespace sync_file_system | 417 } // namespace sync_file_system |
| OLD | NEW |