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/browser/blob/local_file_stream_reader.h" | 5 #include "webkit/browser/blob/local_file_stream_reader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return new LocalFileStreamReader( | 87 return new LocalFileStreamReader( |
88 file_task_runner(), | 88 file_task_runner(), |
89 path, | 89 path, |
90 initial_offset, | 90 initial_offset, |
91 expected_modification_time); | 91 expected_modification_time); |
92 } | 92 } |
93 | 93 |
94 void TouchTestFile() { | 94 void TouchTestFile() { |
95 base::Time new_modified_time = | 95 base::Time new_modified_time = |
96 test_file_modification_time() - base::TimeDelta::FromSeconds(1); | 96 test_file_modification_time() - base::TimeDelta::FromSeconds(1); |
97 ASSERT_TRUE(file_util::TouchFile(test_path(), | 97 ASSERT_TRUE(base::TouchFile(test_path(), |
98 test_file_modification_time(), | 98 test_file_modification_time(), |
99 new_modified_time)); | 99 new_modified_time)); |
100 } | 100 } |
101 | 101 |
102 base::MessageLoopProxy* file_task_runner() const { | 102 base::MessageLoopProxy* file_task_runner() const { |
103 return file_thread_.message_loop_proxy().get(); | 103 return file_thread_.message_loop_proxy().get(); |
104 } | 104 } |
105 | 105 |
106 base::FilePath test_dir() const { return dir_.path(); } | 106 base::FilePath test_dir() const { return dir_.path(); } |
107 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); } | 107 base::FilePath test_path() const { return dir_.path().AppendASCII("test"); } |
108 base::Time test_file_modification_time() const { | 108 base::Time test_file_modification_time() const { |
109 return test_file_modification_time_; | 109 return test_file_modification_time_; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 252 int rv = reader->Read(buf.get(), 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 |