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 "webkit/browser/blob/local_file_stream_reader.h" | 5 #include "storage/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.h" | 10 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/base/test_completion_callback.h" | 18 #include "net/base/test_completion_callback.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 using webkit_blob::LocalFileStreamReader; | 21 using storage::LocalFileStreamReader; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 const char kTestData[] = "0123456789"; | 27 const char kTestData[] = "0123456789"; |
28 const int kTestDataSize = arraysize(kTestData) - 1; | 28 const int kTestDataSize = arraysize(kTestData) - 1; |
29 | 29 |
30 void ReadFromReader(LocalFileStreamReader* reader, | 30 void ReadFromReader(LocalFileStreamReader* reader, |
31 std::string* data, size_t size, | 31 std::string* data, size_t size, |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 249 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); |
250 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 250 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
251 | 251 |
252 // Delete immediately. | 252 // Delete immediately. |
253 // Should not crash; nor should NeverCalled be callback. | 253 // Should not crash; nor should NeverCalled be callback. |
254 reader.reset(); | 254 reader.reset(); |
255 EnsureFileTaskFinished(); | 255 EnsureFileTaskFinished(); |
256 } | 256 } |
257 | 257 |
258 } // namespace content | 258 } // namespace content |
OLD | NEW |