| 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/fileapi/file_system_file_stream_reader.h" | 5 #include "webkit/browser/fileapi/file_system_file_stream_reader.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/platform_file.h" | 12 #include "base/platform_file.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "content/public/test/test_file_system_context.h" |
| 14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
| 15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 16 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "webkit/browser/fileapi/async_file_test_helper.h" | 19 #include "webkit/browser/fileapi/async_file_test_helper.h" |
| 19 #include "webkit/browser/fileapi/external_mount_points.h" | 20 #include "webkit/browser/fileapi/external_mount_points.h" |
| 20 #include "webkit/browser/fileapi/file_system_context.h" | 21 #include "webkit/browser/fileapi/file_system_context.h" |
| 21 #include "webkit/browser/fileapi/file_system_file_util.h" | 22 #include "webkit/browser/fileapi/file_system_file_util.h" |
| 22 #include "webkit/browser/fileapi/mock_file_system_context.h" | |
| 23 | 23 |
| 24 namespace fileapi { | 24 namespace fileapi { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kURLOrigin[] = "http://remote/"; | 28 const char kURLOrigin[] = "http://remote/"; |
| 29 const char kTestFileName[] = "test.dat"; | 29 const char kTestFileName[] = "test.dat"; |
| 30 const char kTestData[] = "0123456789"; | 30 const char kTestData[] = "0123456789"; |
| 31 const int kTestDataSize = arraysize(kTestData) - 1; | 31 const int kTestDataSize = arraysize(kTestData) - 1; |
| 32 | 32 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 new net::IOBufferWithSize(kTestDataSize)); | 257 new net::IOBufferWithSize(kTestDataSize)); |
| 258 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); | 258 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); |
| 259 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); | 259 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); |
| 260 | 260 |
| 261 // Delete immediately. | 261 // Delete immediately. |
| 262 // Should not crash; nor should NeverCalled be callback. | 262 // Should not crash; nor should NeverCalled be callback. |
| 263 reader.reset(); | 263 reader.reset(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace fileapi | 266 } // namespace fileapi |
| OLD | NEW |