| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) | 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) |
| 6 // rather than as part of test_shell_tests because they rely on being able | 6 // rather than as part of test_shell_tests because they rely on being able |
| 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses | 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses |
| 8 // TYPE_UI, which URLRequest doesn't allow. | 8 // TYPE_UI, which URLRequest doesn't allow. |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 url_request_context.blob_storage_controller()->RemoveBlob(blob_url); | 227 url_request_context.blob_storage_controller()->RemoveBlob(blob_url); |
| 228 | 228 |
| 229 EXPECT_EQ(14, bytes_written()); | 229 EXPECT_EQ(14, bytes_written()); |
| 230 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); | 230 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); |
| 231 EXPECT_TRUE(complete()); | 231 EXPECT_TRUE(complete()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(FileSystemOperationWriteTest, TestWriteZero) { | 234 TEST_F(FileSystemOperationWriteTest, TestWriteZero) { |
| 235 GURL blob_url("blob:zero"); | 235 GURL blob_url("blob:zero"); |
| 236 scoped_refptr<webkit_blob::BlobData> blob_data(new webkit_blob::BlobData()); | 236 scoped_refptr<webkit_blob::BlobData> blob_data(new webkit_blob::BlobData()); |
| 237 blob_data->AppendData(""); |
| 237 | 238 |
| 238 TestURLRequestContext url_request_context; | 239 TestURLRequestContext url_request_context; |
| 239 url_request_context.blob_storage_controller()->AddFinishedBlob( | 240 url_request_context.blob_storage_controller()->AddFinishedBlob( |
| 240 blob_url, blob_data); | 241 blob_url, blob_data); |
| 241 | 242 |
| 242 operation()->Write(&url_request_context, URLForPath(virtual_path_), | 243 operation()->Write(&url_request_context, URLForPath(virtual_path_), |
| 243 blob_url, 0, RecordWriteCallback()); | 244 blob_url, 0, RecordWriteCallback()); |
| 244 MessageLoop::current()->Run(); | 245 MessageLoop::current()->Run(); |
| 245 | 246 |
| 246 url_request_context.blob_storage_controller()->RemoveBlob(blob_url); | 247 url_request_context.blob_storage_controller()->RemoveBlob(blob_url); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // so nothing should have happen. | 388 // so nothing should have happen. |
| 388 EXPECT_EQ(0, bytes_written()); | 389 EXPECT_EQ(0, bytes_written()); |
| 389 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); | 390 EXPECT_EQ(base::PLATFORM_FILE_ERROR_ABORT, status()); |
| 390 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); | 391 EXPECT_EQ(base::PLATFORM_FILE_OK, cancel_status()); |
| 391 EXPECT_TRUE(complete()); | 392 EXPECT_TRUE(complete()); |
| 392 } | 393 } |
| 393 | 394 |
| 394 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. | 395 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. |
| 395 | 396 |
| 396 } // namespace fileapi | 397 } // namespace fileapi |
| OLD | NEW |