| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 void WriteFileSystemFile(const std::string& filename, | 204 void WriteFileSystemFile(const std::string& filename, |
| 205 const char* buf, int buf_size, | 205 const char* buf, int buf_size, |
| 206 base::Time* modification_time) { | 206 base::Time* modification_time) { |
| 207 fileapi::FileSystemURL url = | 207 fileapi::FileSystemURL url = |
| 208 file_system_context_->CreateCrackedFileSystemURL( | 208 file_system_context_->CreateCrackedFileSystemURL( |
| 209 GURL(kFileSystemURLOrigin), | 209 GURL(kFileSystemURLOrigin), |
| 210 kFileSystemType, | 210 kFileSystemType, |
| 211 base::FilePath().AppendASCII(filename)); | 211 base::FilePath().AppendASCII(filename)); |
| 212 | 212 |
| 213 ASSERT_EQ(base::PLATFORM_FILE_OK, | 213 ASSERT_EQ(base::File::FILE_OK, |
| 214 fileapi::AsyncFileTestHelper::CreateFileWithData( | 214 fileapi::AsyncFileTestHelper::CreateFileWithData( |
| 215 file_system_context_, url, buf, buf_size)); | 215 file_system_context_, url, buf, buf_size)); |
| 216 | 216 |
| 217 base::PlatformFileInfo file_info; | 217 base::File::Info file_info; |
| 218 ASSERT_EQ(base::PLATFORM_FILE_OK, | 218 ASSERT_EQ(base::File::FILE_OK, |
| 219 fileapi::AsyncFileTestHelper::GetMetadata( | 219 fileapi::AsyncFileTestHelper::GetMetadata( |
| 220 file_system_context_, url, &file_info)); | 220 file_system_context_, url, &file_info)); |
| 221 if (modification_time) | 221 if (modification_time) |
| 222 *modification_time = file_info.last_modified; | 222 *modification_time = file_info.last_modified; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void OnValidateFileSystem(const GURL& root, | 225 void OnValidateFileSystem(const GURL& root, |
| 226 const std::string& name, | 226 const std::string& name, |
| 227 base::PlatformFileError result) { | 227 base::File::Error result) { |
| 228 ASSERT_EQ(base::PLATFORM_FILE_OK, result); | 228 ASSERT_EQ(base::File::FILE_OK, result); |
| 229 ASSERT_TRUE(root.is_valid()); | 229 ASSERT_TRUE(root.is_valid()); |
| 230 file_system_root_url_ = root; | 230 file_system_root_url_ = root; |
| 231 } | 231 } |
| 232 | 232 |
| 233 void TestSuccessNonrangeRequest(const std::string& expected_response, | 233 void TestSuccessNonrangeRequest(const std::string& expected_response, |
| 234 int64 expected_content_length) { | 234 int64 expected_content_length) { |
| 235 expected_status_code_ = 200; | 235 expected_status_code_ = 200; |
| 236 expected_response_ = expected_response; | 236 expected_response_ = expected_response; |
| 237 TestRequest("GET", net::HttpRequestHeaders()); | 237 TestRequest("GET", net::HttpRequestHeaders()); |
| 238 EXPECT_EQ(expected_content_length, | 238 EXPECT_EQ(expected_content_length, |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); | 471 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); |
| 472 EXPECT_EQ(kTestContentType, content_type); | 472 EXPECT_EQ(kTestContentType, content_type); |
| 473 void* iter = NULL; | 473 void* iter = NULL; |
| 474 std::string content_disposition; | 474 std::string content_disposition; |
| 475 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( | 475 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( |
| 476 &iter, "Content-Disposition", &content_disposition)); | 476 &iter, "Content-Disposition", &content_disposition)); |
| 477 EXPECT_EQ(kTestContentDisposition, content_disposition); | 477 EXPECT_EQ(kTestContentDisposition, content_disposition); |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace content | 480 } // namespace content |
| OLD | NEW |