| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "content/browser/fileapi/mock_file_change_observer.h" | 15 #include "content/browser/fileapi/mock_file_change_observer.h" |
| 16 #include "content/browser/quota/mock_quota_manager.h" | 16 #include "content/browser/quota/mock_quota_manager.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 EXPECT_EQ(base::File::FILE_OK, status()); | 205 EXPECT_EQ(base::File::FILE_OK, status()); |
| 206 EXPECT_TRUE(complete()); | 206 EXPECT_TRUE(complete()); |
| 207 | 207 |
| 208 EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count()); | 208 EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidBlobUrl) { | 212 TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidBlobUrl) { |
| 213 scoped_ptr<storage::BlobDataHandle> null_handle; | 213 scoped_ptr<storage::BlobDataHandle> null_handle; |
| 214 file_system_context_->operation_runner()->Write( | 214 file_system_context_->operation_runner()->Write( |
| 215 &url_request_context(), URLForPath(virtual_path_), | 215 &url_request_context(), URLForPath(virtual_path_), std::move(null_handle), |
| 216 null_handle.Pass(), 0, RecordWriteCallback()); | 216 0, RecordWriteCallback()); |
| 217 base::MessageLoop::current()->Run(); | 217 base::MessageLoop::current()->Run(); |
| 218 | 218 |
| 219 EXPECT_EQ(0, bytes_written()); | 219 EXPECT_EQ(0, bytes_written()); |
| 220 EXPECT_EQ(base::File::FILE_ERROR_FAILED, status()); | 220 EXPECT_EQ(base::File::FILE_ERROR_FAILED, status()); |
| 221 EXPECT_TRUE(complete()); | 221 EXPECT_TRUE(complete()); |
| 222 | 222 |
| 223 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); | 223 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidFile) { | 226 TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidFile) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); | 324 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); |
| 325 EXPECT_EQ(base::File::FILE_OK, cancel_status()); | 325 EXPECT_EQ(base::File::FILE_OK, cancel_status()); |
| 326 EXPECT_TRUE(complete()); | 326 EXPECT_TRUE(complete()); |
| 327 | 327 |
| 328 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); | 328 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. | 331 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. |
| 332 | 332 |
| 333 } // namespace content | 333 } // namespace content |
| OLD | NEW |