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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 public net::URLRequestJobFactory::ProtocolHandler { | 116 public net::URLRequestJobFactory::ProtocolHandler { |
117 public: | 117 public: |
118 MockProtocolHandler(BlobURLRequestJobTest* test) : test_(test) {} | 118 MockProtocolHandler(BlobURLRequestJobTest* test) : test_(test) {} |
119 | 119 |
120 // net::URLRequestJobFactory::ProtocolHandler override. | 120 // net::URLRequestJobFactory::ProtocolHandler override. |
121 virtual net::URLRequestJob* MaybeCreateJob( | 121 virtual net::URLRequestJob* MaybeCreateJob( |
122 net::URLRequest* request, | 122 net::URLRequest* request, |
123 net::NetworkDelegate* network_delegate) const OVERRIDE { | 123 net::NetworkDelegate* network_delegate) const OVERRIDE { |
124 return new BlobURLRequestJob(request, | 124 return new BlobURLRequestJob(request, |
125 network_delegate, | 125 network_delegate, |
126 test_->blob_data_, | 126 test_->blob_data_.get(), |
127 test_->file_system_context_, | 127 test_->file_system_context_.get(), |
128 base::MessageLoopProxy::current()); | 128 base::MessageLoopProxy::current()); |
129 } | 129 } |
130 | 130 |
131 private: | 131 private: |
132 BlobURLRequestJobTest* test_; | 132 BlobURLRequestJobTest* test_; |
133 }; | 133 }; |
134 | 134 |
135 BlobURLRequestJobTest() | 135 BlobURLRequestJobTest() |
136 : message_loop_(base::MessageLoop::TYPE_IO), | 136 : message_loop_(base::MessageLoop::TYPE_IO), |
137 blob_data_(new BlobData()), | 137 blob_data_(new BlobData()), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 base::Time* modification_time) { | 200 base::Time* modification_time) { |
201 fileapi::FileSystemURL url = | 201 fileapi::FileSystemURL url = |
202 file_system_context_->CreateCrackedFileSystemURL( | 202 file_system_context_->CreateCrackedFileSystemURL( |
203 GURL(kFileSystemURLOrigin), | 203 GURL(kFileSystemURLOrigin), |
204 kFileSystemType, | 204 kFileSystemType, |
205 base::FilePath().AppendASCII(filename)); | 205 base::FilePath().AppendASCII(filename)); |
206 | 206 |
207 fileapi::FileSystemFileUtil* file_util = | 207 fileapi::FileSystemFileUtil* file_util = |
208 file_system_context_->GetFileUtil(kFileSystemType); | 208 file_system_context_->GetFileUtil(kFileSystemType); |
209 | 209 |
210 fileapi::FileSystemOperationContext context(file_system_context_); | 210 fileapi::FileSystemOperationContext context(file_system_context_.get()); |
211 context.set_allowed_bytes_growth(1024); | 211 context.set_allowed_bytes_growth(1024); |
212 | 212 |
213 base::PlatformFile handle = base::kInvalidPlatformFileValue; | 213 base::PlatformFile handle = base::kInvalidPlatformFileValue; |
214 bool created = false; | 214 bool created = false; |
215 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( | 215 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( |
216 &context, | 216 &context, |
217 url, | 217 url, |
218 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, | 218 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, |
219 &handle, | 219 &handle, |
220 &created)); | 220 &created)); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); | 442 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); |
443 EXPECT_EQ(kTestContentType, content_type); | 443 EXPECT_EQ(kTestContentType, content_type); |
444 void* iter = NULL; | 444 void* iter = NULL; |
445 std::string content_disposition; | 445 std::string content_disposition; |
446 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( | 446 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( |
447 &iter, "Content-Disposition", &content_disposition)); | 447 &iter, "Content-Disposition", &content_disposition)); |
448 EXPECT_EQ(kTestContentDisposition, content_disposition); | 448 EXPECT_EQ(kTestContentDisposition, content_disposition); |
449 } | 449 } |
450 | 450 |
451 } // namespace webkit_blob | 451 } // namespace webkit_blob |
OLD | NEW |