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..595775abddc2510489ded567fea1f284464fd625 100644 |
--- a/content/browser/fileapi/blob_url_request_job_unittest.cc |
+++ b/content/browser/fileapi/blob_url_request_job_unittest.cc |
@@ -98,6 +98,12 @@ class BlobURLRequestJobTest : public testing::Test { |
base::GetFileInfo(temp_file2_, &file_info2); |
temp_file_modification_time2_ = file_info2.last_modified; |
+ ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), |
+ &temp_empty_file_)); |
+ 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 +137,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 +218,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 +247,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 +433,8 @@ TEST_F(BlobURLRequestJobTest, TestExtraHeaders) { |
EXPECT_EQ(kTestContentDisposition, content_disposition); |
} |
+TEST_F(BlobURLRequestJobTest, TestGetEmptyDataRequest) { |
+ TestSuccessNonrangeRequest("", 0); |
+} |
+ |
} // namespace content |