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 #include "webkit/blob/local_file_stream_reader.h" | 5 #include "webkit/blob/local_file_stream_reader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 ASSERT_TRUE(dir_.CreateUniqueTempDir()); | 68 ASSERT_TRUE(dir_.CreateUniqueTempDir()); |
69 | 69 |
70 file_util::WriteFile(test_path(), kTestData, kTestDataSize); | 70 file_util::WriteFile(test_path(), kTestData, kTestDataSize); |
71 base::PlatformFileInfo info; | 71 base::PlatformFileInfo info; |
72 ASSERT_TRUE(file_util::GetFileInfo(test_path(), &info)); | 72 ASSERT_TRUE(file_util::GetFileInfo(test_path(), &info)); |
73 test_file_modification_time_ = info.last_modified; | 73 test_file_modification_time_ = info.last_modified; |
74 } | 74 } |
75 | 75 |
76 virtual void TearDown() OVERRIDE { | 76 virtual void TearDown() OVERRIDE { |
77 // Give another chance for deleted streams to perform Close. | 77 // Give another chance for deleted streams to perform Close. |
78 MessageLoop::current()->RunAllPending(); | 78 MessageLoop::current()->RunUntilIdle(); |
79 file_thread_.Stop(); | 79 file_thread_.Stop(); |
80 } | 80 } |
81 | 81 |
82 protected: | 82 protected: |
83 LocalFileStreamReader* CreateFileReader( | 83 LocalFileStreamReader* CreateFileReader( |
84 const FilePath& path, | 84 const FilePath& path, |
85 int64 initial_offset, | 85 int64 initial_offset, |
86 const base::Time& expected_modification_time) { | 86 const base::Time& expected_modification_time) { |
87 return new LocalFileStreamReader( | 87 return new LocalFileStreamReader( |
88 file_task_runner(), | 88 file_task_runner(), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); | 252 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); |
253 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 253 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
254 | 254 |
255 // Delete immediately. | 255 // Delete immediately. |
256 // Should not crash; nor should NeverCalled be callback. | 256 // Should not crash; nor should NeverCalled be callback. |
257 reader.reset(); | 257 reader.reset(); |
258 EnsureFileTaskFinished(); | 258 EnsureFileTaskFinished(); |
259 } | 259 } |
260 | 260 |
261 } // namespace webkit_blob | 261 } // namespace webkit_blob |
OLD | NEW |