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 "storage/browser/fileapi/local_file_stream_reader.h" | 5 #include "storage/browser/fileapi/local_file_stream_reader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 break; | 49 break; |
50 total_bytes_read += rv; | 50 total_bytes_read += rv; |
51 data->append(buf->data(), rv); | 51 data->append(buf->data(), rv); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 void NeverCalled(int) { ADD_FAILURE(); } | 55 void NeverCalled(int) { ADD_FAILURE(); } |
56 void EmptyCallback() {} | 56 void EmptyCallback() {} |
57 | 57 |
58 void QuitLoop() { | 58 void QuitLoop() { |
59 base::MessageLoop::current()->Quit(); | 59 base::MessageLoop::current()->QuitWhenIdle(); |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
63 | 63 |
64 class LocalFileStreamReaderTest : public testing::Test { | 64 class LocalFileStreamReaderTest : public testing::Test { |
65 public: | 65 public: |
66 LocalFileStreamReaderTest() | 66 LocalFileStreamReaderTest() |
67 : file_thread_("FileUtilProxyTestFileThread") {} | 67 : file_thread_("FileUtilProxyTestFileThread") {} |
68 | 68 |
69 void SetUp() override { | 69 void SetUp() override { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 268 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); |
269 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 269 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
270 | 270 |
271 // Delete immediately. | 271 // Delete immediately. |
272 // Should not crash; nor should NeverCalled be callback. | 272 // Should not crash; nor should NeverCalled be callback. |
273 reader.reset(); | 273 reader.reset(); |
274 EnsureFileTaskFinished(); | 274 EnsureFileTaskFinished(); |
275 } | 275 } |
276 | 276 |
277 } // namespace content | 277 } // namespace content |
OLD | NEW |