| 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 "net/base/file_stream.h" | 5 #include "net/base/file_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 base::FilePath test_dir; | 838 base::FilePath test_dir; |
| 839 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); | 839 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); |
| 840 test_dir = test_dir.AppendASCII("net"); | 840 test_dir = test_dir.AppendASCII("net"); |
| 841 test_dir = test_dir.AppendASCII("data"); | 841 test_dir = test_dir.AppendASCII("data"); |
| 842 test_dir = test_dir.AppendASCII("file_stream_unittest"); | 842 test_dir = test_dir.AppendASCII("file_stream_unittest"); |
| 843 ASSERT_TRUE(base::PathExists(test_dir)); | 843 ASSERT_TRUE(base::PathExists(test_dir)); |
| 844 base::FilePath image_file = test_dir.Append(FILE_PATH_LITERAL("red.png")); | 844 base::FilePath image_file = test_dir.Append(FILE_PATH_LITERAL("red.png")); |
| 845 | 845 |
| 846 // Insert the image into MediaStore. MediaStore will do some conversions, and | 846 // Insert the image into MediaStore. MediaStore will do some conversions, and |
| 847 // return the content URI. | 847 // return the content URI. |
| 848 base::FilePath path = file_util::InsertImageIntoMediaStore(image_file); | 848 base::FilePath path = base::InsertImageIntoMediaStore(image_file); |
| 849 EXPECT_TRUE(path.IsContentUri()); | 849 EXPECT_TRUE(path.IsContentUri()); |
| 850 EXPECT_TRUE(base::PathExists(path)); | 850 EXPECT_TRUE(base::PathExists(path)); |
| 851 int64 file_size; | 851 int64 file_size; |
| 852 EXPECT_TRUE(base::GetFileSize(path, &file_size)); | 852 EXPECT_TRUE(base::GetFileSize(path, &file_size)); |
| 853 EXPECT_LT(0, file_size); | 853 EXPECT_LT(0, file_size); |
| 854 | 854 |
| 855 FileStream stream(base::MessageLoopProxy::current()); | 855 FileStream stream(base::MessageLoopProxy::current()); |
| 856 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | | 856 int flags = base::File::FLAG_OPEN | base::File::FLAG_READ | |
| 857 base::File::FLAG_ASYNC; | 857 base::File::FLAG_ASYNC; |
| 858 TestCompletionCallback callback; | 858 TestCompletionCallback callback; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 874 total_bytes_read += rv; | 874 total_bytes_read += rv; |
| 875 data_read.append(buf->data(), rv); | 875 data_read.append(buf->data(), rv); |
| 876 } | 876 } |
| 877 EXPECT_EQ(file_size, total_bytes_read); | 877 EXPECT_EQ(file_size, total_bytes_read); |
| 878 } | 878 } |
| 879 #endif | 879 #endif |
| 880 | 880 |
| 881 } // namespace | 881 } // namespace |
| 882 | 882 |
| 883 } // namespace net | 883 } // namespace net |
| OLD | NEW |