| 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/fileapi/file_system_url_request_job.h" | 5 #include "webkit/fileapi/file_system_url_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 const net::HttpRequestHeaders* headers) { | 134 const net::HttpRequestHeaders* headers) { |
| 135 TestRequestHelper(url, headers, true); | 135 TestRequestHelper(url, headers, true); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void TestRequestNoRun(const GURL& url) { | 138 void TestRequestNoRun(const GURL& url) { |
| 139 TestRequestHelper(url, NULL, false); | 139 TestRequestHelper(url, NULL, false); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CreateDirectory(const base::StringPiece& dir_name) { | 142 void CreateDirectory(const base::StringPiece& dir_name) { |
| 143 FileSystemFileUtil* file_util = file_system_context_-> | 143 FileSystemFileUtil* file_util = file_system_context_-> |
| 144 sandbox_provider()->GetFileUtil(); | 144 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary); |
| 145 FileSystemURL url(GURL("http://remote"), | 145 FileSystemURL url(GURL("http://remote"), |
| 146 kFileSystemTypeTemporary, | 146 kFileSystemTypeTemporary, |
| 147 FilePath().AppendASCII(dir_name)); | 147 FilePath().AppendASCII(dir_name)); |
| 148 | 148 |
| 149 FileSystemOperationContext context(file_system_context_); | 149 FileSystemOperationContext context(file_system_context_); |
| 150 context.set_allowed_bytes_growth(1024); | 150 context.set_allowed_bytes_growth(1024); |
| 151 | 151 |
| 152 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory( | 152 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory( |
| 153 &context, | 153 &context, |
| 154 url, | 154 url, |
| 155 false /* exclusive */, | 155 false /* exclusive */, |
| 156 false /* recursive */)); | 156 false /* recursive */)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void WriteFile(const base::StringPiece& file_name, | 159 void WriteFile(const base::StringPiece& file_name, |
| 160 const char* buf, int buf_size) { | 160 const char* buf, int buf_size) { |
| 161 FileSystemFileUtil* file_util = file_system_context_-> | 161 FileSystemFileUtil* file_util = file_system_context_-> |
| 162 sandbox_provider()->GetFileUtil(); | 162 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary); |
| 163 FileSystemURL url(GURL("http://remote"), | 163 FileSystemURL url(GURL("http://remote"), |
| 164 kFileSystemTypeTemporary, | 164 kFileSystemTypeTemporary, |
| 165 FilePath().AppendASCII(file_name)); | 165 FilePath().AppendASCII(file_name)); |
| 166 | 166 |
| 167 FileSystemOperationContext context(file_system_context_); | 167 FileSystemOperationContext context(file_system_context_); |
| 168 context.set_allowed_bytes_growth(1024); | 168 context.set_allowed_bytes_growth(1024); |
| 169 | 169 |
| 170 base::PlatformFile handle = base::kInvalidPlatformFileValue; | 170 base::PlatformFile handle = base::kInvalidPlatformFileValue; |
| 171 bool created = false; | 171 bool created = false; |
| 172 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( | 172 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 TestRequest(CreateFileSystemURL(kFilename)); | 367 TestRequest(CreateFileSystemURL(kFilename)); |
| 368 | 368 |
| 369 std::string mime_type_from_job; | 369 std::string mime_type_from_job; |
| 370 request_->GetMimeType(&mime_type_from_job); | 370 request_->GetMimeType(&mime_type_from_job); |
| 371 EXPECT_EQ(mime_type_direct, mime_type_from_job); | 371 EXPECT_EQ(mime_type_direct, mime_type_from_job); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace | 374 } // namespace |
| 375 } // namespace fileapi | 375 } // namespace fileapi |
| OLD | NEW |