| 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 "storage/browser/fileapi/file_system_file_stream_reader.h" | 5 #include "storage/browser/fileapi/file_system_file_stream_reader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| 69 | 69 |
| 70 class FileSystemFileStreamReaderTest : public testing::Test { | 70 class FileSystemFileStreamReaderTest : public testing::Test { |
| 71 public: | 71 public: |
| 72 FileSystemFileStreamReaderTest() {} | 72 FileSystemFileStreamReaderTest() {} |
| 73 | 73 |
| 74 void SetUp() override { | 74 void SetUp() override { |
| 75 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 75 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 76 | 76 |
| 77 file_system_context_ = CreateFileSystemContextForTesting( | 77 file_system_context_ = |
| 78 NULL, temp_dir_.path()); | 78 CreateFileSystemContextForTesting(NULL, temp_dir_.GetPath()); |
| 79 | 79 |
| 80 file_system_context_->OpenFileSystem( | 80 file_system_context_->OpenFileSystem( |
| 81 GURL(kURLOrigin), | 81 GURL(kURLOrigin), |
| 82 storage::kFileSystemTypeTemporary, | 82 storage::kFileSystemTypeTemporary, |
| 83 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 83 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 84 base::Bind(&OnOpenFileSystem)); | 84 base::Bind(&OnOpenFileSystem)); |
| 85 base::RunLoop().RunUntilIdle(); | 85 base::RunLoop().RunUntilIdle(); |
| 86 | 86 |
| 87 WriteFile(kTestFileName, kTestData, kTestDataSize, | 87 WriteFile(kTestFileName, kTestData, kTestDataSize, |
| 88 &test_file_modification_time_); | 88 &test_file_modification_time_); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 new net::IOBufferWithSize(kTestDataSize)); | 265 new net::IOBufferWithSize(kTestDataSize)); |
| 266 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 266 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); |
| 267 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 267 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
| 268 | 268 |
| 269 // Delete immediately. | 269 // Delete immediately. |
| 270 // Should not crash; nor should NeverCalled be callback. | 270 // Should not crash; nor should NeverCalled be callback. |
| 271 reader.reset(); | 271 reader.reset(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace content | 274 } // namespace content |
| OLD | NEW |