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/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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 : blob_data_(new BlobData()), | 138 : blob_data_(new BlobData()), |
139 expected_status_code_(0) {} | 139 expected_status_code_(0) {} |
140 | 140 |
141 virtual void SetUp() { | 141 virtual void SetUp() { |
142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 142 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
143 | 143 |
144 temp_file1_ = temp_dir_.path().AppendASCII("BlobFile1.dat"); | 144 temp_file1_ = temp_dir_.path().AppendASCII("BlobFile1.dat"); |
145 ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1), | 145 ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1), |
146 file_util::WriteFile(temp_file1_, kTestFileData1, | 146 file_util::WriteFile(temp_file1_, kTestFileData1, |
147 arraysize(kTestFileData1) - 1)); | 147 arraysize(kTestFileData1) - 1)); |
148 base::PlatformFileInfo file_info1; | 148 base::File::Info file_info1; |
149 base::GetFileInfo(temp_file1_, &file_info1); | 149 base::GetFileInfo(temp_file1_, &file_info1); |
150 temp_file_modification_time1_ = file_info1.last_modified; | 150 temp_file_modification_time1_ = file_info1.last_modified; |
151 | 151 |
152 temp_file2_ = temp_dir_.path().AppendASCII("BlobFile2.dat"); | 152 temp_file2_ = temp_dir_.path().AppendASCII("BlobFile2.dat"); |
153 ASSERT_EQ(static_cast<int>(arraysize(kTestFileData2) - 1), | 153 ASSERT_EQ(static_cast<int>(arraysize(kTestFileData2) - 1), |
154 file_util::WriteFile(temp_file2_, kTestFileData2, | 154 file_util::WriteFile(temp_file2_, kTestFileData2, |
155 arraysize(kTestFileData2) - 1)); | 155 arraysize(kTestFileData2) - 1)); |
156 base::PlatformFileInfo file_info2; | 156 base::File::Info file_info2; |
157 base::GetFileInfo(temp_file2_, &file_info2); | 157 base::GetFileInfo(temp_file2_, &file_info2); |
158 temp_file_modification_time2_ = file_info2.last_modified; | 158 temp_file_modification_time2_ = file_info2.last_modified; |
159 | 159 |
160 url_request_job_factory_.SetProtocolHandler("blob", | 160 url_request_job_factory_.SetProtocolHandler("blob", |
161 new MockProtocolHandler(this)); | 161 new MockProtocolHandler(this)); |
162 url_request_context_.set_job_factory(&url_request_job_factory_); | 162 url_request_context_.set_job_factory(&url_request_job_factory_); |
163 } | 163 } |
164 | 164 |
165 virtual void TearDown() { | 165 virtual void TearDown() { |
166 } | 166 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); | 429 EXPECT_TRUE(request_->response_headers()->GetMimeType(&content_type)); |
430 EXPECT_EQ(kTestContentType, content_type); | 430 EXPECT_EQ(kTestContentType, content_type); |
431 void* iter = NULL; | 431 void* iter = NULL; |
432 std::string content_disposition; | 432 std::string content_disposition; |
433 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( | 433 EXPECT_TRUE(request_->response_headers()->EnumerateHeader( |
434 &iter, "Content-Disposition", &content_disposition)); | 434 &iter, "Content-Disposition", &content_disposition)); |
435 EXPECT_EQ(kTestContentDisposition, content_disposition); | 435 EXPECT_EQ(kTestContentDisposition, content_disposition); |
436 } | 436 } |
437 | 437 |
438 } // namespace webkit_blob | 438 } // namespace webkit_blob |
OLD | NEW |