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 "net/url_request/url_request_file_job.h" | 5 #include "net/url_request/url_request_file_job.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 RunRequest(content, content, FILE_PATH_LITERAL(""), range); | 181 RunRequest(content, content, FILE_PATH_LITERAL(""), range); |
182 } | 182 } |
183 | 183 |
184 void URLRequestFileJobEventsTest::RunRequest( | 184 void URLRequestFileJobEventsTest::RunRequest( |
185 const std::string& raw_content, | 185 const std::string& raw_content, |
186 const std::string& expected_content, | 186 const std::string& expected_content, |
187 const base::FilePath::StringPieceType& file_extension, | 187 const base::FilePath::StringPieceType& file_extension, |
188 const Range* range) { | 188 const Range* range) { |
189 base::ScopedTempDir directory; | 189 base::ScopedTempDir directory; |
190 ASSERT_TRUE(directory.CreateUniqueTempDir()); | 190 ASSERT_TRUE(directory.CreateUniqueTempDir()); |
191 base::FilePath path = directory.path().Append(FILE_PATH_LITERAL("test")); | 191 base::FilePath path = directory.GetPath().Append(FILE_PATH_LITERAL("test")); |
192 if (!file_extension.empty()) | 192 if (!file_extension.empty()) |
193 path = path.AddExtension(file_extension); | 193 path = path.AddExtension(file_extension); |
194 ASSERT_TRUE(CreateFileWithContent(raw_content, path)); | 194 ASSERT_TRUE(CreateFileWithContent(raw_content, path)); |
195 | 195 |
196 { | 196 { |
197 int64_t seek_position; | 197 int64_t seek_position; |
198 std::string observed_content; | 198 std::string observed_content; |
199 TestJobFactory factory(path, &seek_position, &observed_content); | 199 TestJobFactory factory(path, &seek_position, &observed_content); |
200 context_.set_job_factory(&factory); | 200 context_.set_job_factory(&factory); |
201 | 201 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 0x1f, 0x8b, 0x08, 0x00, 0x2b, 0x02, 0x84, 0x55, 0x00, 0x03, 0xf3, | 278 0x1f, 0x8b, 0x08, 0x00, 0x2b, 0x02, 0x84, 0x55, 0x00, 0x03, 0xf3, |
279 0x48, 0xcd, 0xc9, 0xc9, 0xd7, 0x51, 0x08, 0xcf, 0x2f, 0xca, 0x49, | 279 0x48, 0xcd, 0xc9, 0xc9, 0xd7, 0x51, 0x08, 0xcf, 0x2f, 0xca, 0x49, |
280 0x51, 0x04, 0x00, 0xd0, 0xc3, 0x4a, 0xec, 0x0d, 0x00, 0x00, 0x00}; | 280 0x51, 0x04, 0x00, 0xd0, 0xc3, 0x4a, 0xec, 0x0d, 0x00, 0x00, 0x00}; |
281 RunRequest(std::string(reinterpret_cast<char*>(gzip_data), sizeof(gzip_data)), | 281 RunRequest(std::string(reinterpret_cast<char*>(gzip_data), sizeof(gzip_data)), |
282 expected_content, FILE_PATH_LITERAL("svgz"), nullptr); | 282 expected_content, FILE_PATH_LITERAL("svgz"), nullptr); |
283 } | 283 } |
284 | 284 |
285 } // namespace | 285 } // namespace |
286 | 286 |
287 } // namespace net | 287 } // namespace net |
OLD | NEW |