Chromium Code Reviews| Index: content/browser/fileapi/blob_url_request_job_unittest.cc |
| diff --git a/content/browser/fileapi/blob_url_request_job_unittest.cc b/content/browser/fileapi/blob_url_request_job_unittest.cc |
| index 4a30e11aef40eb1afefc5765aeb883a4f4d43019..5b103e775f96ee3092c0f2e5054fcd07c1850a18 100644 |
| --- a/content/browser/fileapi/blob_url_request_job_unittest.cc |
| +++ b/content/browser/fileapi/blob_url_request_job_unittest.cc |
| @@ -98,6 +98,13 @@ class BlobURLRequestJobTest : public testing::Test { |
| base::GetFileInfo(temp_file2_, &file_info2); |
| temp_file_modification_time2_ = file_info2.last_modified; |
| + temp_empty_file_ = temp_dir_.path().AppendASCII("EmptyBlobFile.dat"); |
| + ASSERT_EQ(static_cast<int>(0), |
|
cmumford
2014/07/31 18:44:43
Why the static_cast? Isn't 0 an integer literal al
pwnall-personal
2014/07/31 19:34:47
Done.
|
| + base::WriteFile(temp_empty_file_, kTestFileData1, 0)); |
|
cmumford
2014/07/31 18:44:43
Nit: This certainly works, but maybe CreateTempora
pwnall-personal
2014/07/31 19:34:47
Done.
|
| + base::File::Info empty_file_info; |
| + base::GetFileInfo(temp_empty_file_, &empty_file_info); |
| + temp_empty_file_modification_time_ = empty_file_info.last_modified; |
| + |
| url_request_job_factory_.SetProtocolHandler("blob", |
| new MockProtocolHandler(this)); |
| url_request_context_.set_job_factory(&url_request_job_factory_); |
| @@ -131,6 +138,10 @@ class BlobURLRequestJobTest : public testing::Test { |
| WriteFileSystemFile(kFilename2, kTestFileSystemFileData2, |
| arraysize(kTestFileSystemFileData2) - 1, |
| &temp_file_system_file_modification_time2_); |
| + const char kEmptyFilename[] = "EmptyFileSystemFile.dat"; |
| + temp_empty_file_system_file_ = GetFileSystemURL(kEmptyFilename); |
| + WriteFileSystemFile(kEmptyFilename, kTestFileSystemFileData1, |
| + 0, &temp_empty_file_system_file_modification_time_); |
| } |
| GURL GetFileSystemURL(const std::string& filename) { |
| @@ -208,6 +219,11 @@ class BlobURLRequestJobTest : public testing::Test { |
| blob_data_->AppendFile(temp_file2_, 5, 6, temp_file_modification_time2_); |
| blob_data_->AppendFileSystemFile(temp_file_system_file2_, 6, 7, |
| temp_file_system_file_modification_time2_); |
| + blob_data_->AppendFile(temp_empty_file_, 0, 0, |
| + temp_empty_file_modification_time_); |
| + blob_data_->AppendFileSystemFile( |
| + temp_empty_file_system_file_, 0, 0, |
| + temp_empty_file_system_file_modification_time_); |
| *expected_result = std::string(kTestData1 + 1, 2); |
| *expected_result += std::string(kTestFileData1 + 2, 3); |
| *expected_result += std::string(kTestFileSystemFileData1 + 3, 4); |
| @@ -232,13 +248,17 @@ class BlobURLRequestJobTest : public testing::Test { |
| protected: |
| base::ScopedTempDir temp_dir_; |
| + base::FilePath temp_empty_file_; |
| base::FilePath temp_file1_; |
| base::FilePath temp_file2_; |
| + base::Time temp_empty_file_modification_time_; |
| base::Time temp_file_modification_time1_; |
| base::Time temp_file_modification_time2_; |
| GURL file_system_root_url_; |
| + GURL temp_empty_file_system_file_; |
| GURL temp_file_system_file1_; |
| GURL temp_file_system_file2_; |
| + base::Time temp_empty_file_system_file_modification_time_; |
| base::Time temp_file_system_file_modification_time1_; |
| base::Time temp_file_system_file_modification_time2_; |
| @@ -414,4 +434,8 @@ TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
| EXPECT_EQ(kTestContentDisposition, content_disposition); |
| } |
| +TEST_F(BlobURLRequestJobTest, TestGetEmptyDataRequest) { |
| + TestSuccessNonrangeRequest("", 0); |
| +} |
| + |
| } // namespace content |