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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize)); | 163 scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize)); |
164 | 164 |
165 const int result = | 165 const int result = |
166 reader.Read(io_buffer.get(), | 166 reader.Read(io_buffer.get(), |
167 kFakeFileSize, | 167 kFakeFileSize, |
168 base::Bind(&EventLogger::OnRead, logger.GetWeakPtr())); | 168 base::Bind(&EventLogger::OnRead, logger.GetWeakPtr())); |
169 EXPECT_EQ(net::ERR_IO_PENDING, result); | 169 EXPECT_EQ(net::ERR_IO_PENDING, result); |
170 base::RunLoop().RunUntilIdle(); | 170 base::RunLoop().RunUntilIdle(); |
171 | 171 |
172 ASSERT_EQ(1u, logger.results().size()); | 172 ASSERT_EQ(1u, logger.results().size()); |
173 EXPECT_EQ(net::ERR_FAILED, logger.results()[0]); | 173 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, logger.results()[0]); |
174 } | 174 } |
175 | 175 |
176 TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) { | 176 TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) { |
177 EventLogger logger; | 177 EventLogger logger; |
178 | 178 |
179 const int64 initial_offset = 0; | 179 const int64 initial_offset = 0; |
180 FileStreamReader reader(NULL, | 180 FileStreamReader reader(NULL, |
181 file_url_, | 181 file_url_, |
182 initial_offset, | 182 initial_offset, |
183 base::Time::Now()); // Not used yet. | 183 base::Time::Now()); // Not used yet. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 wrong_file_url_, | 281 wrong_file_url_, |
282 initial_offset, | 282 initial_offset, |
283 base::Time::Now()); // Not used yet. | 283 base::Time::Now()); // Not used yet. |
284 | 284 |
285 const int result = reader.GetLength( | 285 const int result = reader.GetLength( |
286 base::Bind(&EventLogger::OnGetLength, logger.GetWeakPtr())); | 286 base::Bind(&EventLogger::OnGetLength, logger.GetWeakPtr())); |
287 EXPECT_EQ(net::ERR_IO_PENDING, result); | 287 EXPECT_EQ(net::ERR_IO_PENDING, result); |
288 base::RunLoop().RunUntilIdle(); | 288 base::RunLoop().RunUntilIdle(); |
289 | 289 |
290 ASSERT_EQ(1u, logger.results().size()); | 290 ASSERT_EQ(1u, logger.results().size()); |
291 EXPECT_EQ(net::ERR_FAILED, logger.results()[0]); | 291 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, logger.results()[0]); |
292 } | 292 } |
293 | 293 |
294 } // namespace file_system_provider | 294 } // namespace file_system_provider |
295 } // namespace chromeos | 295 } // namespace chromeos |
OLD | NEW |