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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 base::FilePath test_dir() const { return dir_.path(); } | 113 base::FilePath test_dir() const { return dir_.path(); } |
114 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); } | 114 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); } |
115 base::Time test_file_modification_time() const { | 115 base::Time test_file_modification_time() const { |
116 return test_file_modification_time_; | 116 return test_file_modification_time_; |
117 } | 117 } |
118 | 118 |
119 void EnsureFileTaskFinished() { | 119 void EnsureFileTaskFinished() { |
120 file_task_runner()->PostTaskAndReply( | 120 file_task_runner()->PostTaskAndReply( |
121 FROM_HERE, base::Bind(&EmptyCallback), base::Bind(&QuitLoop)); | 121 FROM_HERE, base::Bind(&EmptyCallback), base::Bind(&QuitLoop)); |
122 base::MessageLoop::current()->Run(); | 122 base::RunLoop().Run(); |
123 } | 123 } |
124 | 124 |
125 private: | 125 private: |
126 base::MessageLoopForIO message_loop_; | 126 base::MessageLoopForIO message_loop_; |
127 base::Thread file_thread_; | 127 base::Thread file_thread_; |
128 base::ScopedTempDir dir_; | 128 base::ScopedTempDir dir_; |
129 base::Time test_file_modification_time_; | 129 base::Time test_file_modification_time_; |
130 }; | 130 }; |
131 | 131 |
132 TEST_F(LocalFileStreamReaderTest, NonExistent) { | 132 TEST_F(LocalFileStreamReaderTest, NonExistent) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 272 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); |
273 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 273 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
274 | 274 |
275 // Delete immediately. | 275 // Delete immediately. |
276 // Should not crash; nor should NeverCalled be callback. | 276 // Should not crash; nor should NeverCalled be callback. |
277 reader.reset(); | 277 reader.reset(); |
278 EnsureFileTaskFinished(); | 278 EnsureFileTaskFinished(); |
279 } | 279 } |
280 | 280 |
281 } // namespace content | 281 } // namespace content |
OLD | NEW |