| Index: content/browser/blob_storage/blob_url_unittest.cc
|
| diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc
|
| index fef673889802c355671d7ed6e4ab90c0ae9a0fc3..ed09cd46ebe740e3469e9e126507eee392584c92 100644
|
| --- a/content/browser/blob_storage/blob_url_unittest.cc
|
| +++ b/content/browser/blob_storage/blob_url_unittest.cc
|
| @@ -158,6 +158,7 @@ class BlobURLRequestJobTest : public testing::Test {
|
| : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
|
| blob_data_(new BlobDataBuilder("uuid")),
|
| response_error_code_(net::OK),
|
| + expected_error_code_(net::OK),
|
| expected_status_code_(0) {}
|
|
|
| void SetUp() override {
|
| @@ -256,14 +257,15 @@ class BlobURLRequestJobTest : public testing::Test {
|
|
|
| void TestSuccessNonrangeRequest(const std::string& expected_response,
|
| int64_t expected_content_length) {
|
| + expected_error_code_ = net::OK;
|
| expected_status_code_ = 200;
|
| expected_response_ = expected_response;
|
| TestRequest("GET", net::HttpRequestHeaders());
|
| EXPECT_EQ(expected_content_length, response_headers_->GetContentLength());
|
| }
|
|
|
| - void TestErrorRequest(int expected_status_code) {
|
| - expected_status_code_ = expected_status_code;
|
| + void TestErrorRequest(int expected_error_code) {
|
| + expected_error_code_ = expected_error_code;
|
| expected_response_ = "";
|
| TestRequest("GET", net::HttpRequestHeaders());
|
| EXPECT_TRUE(response_metadata_.empty());
|
| @@ -326,9 +328,11 @@ class BlobURLRequestJobTest : public testing::Test {
|
| }
|
|
|
| // Verify response.
|
| - EXPECT_EQ(net::OK, response_error_code_);
|
| - EXPECT_EQ(expected_status_code_, response_headers_->response_code());
|
| - EXPECT_EQ(expected_response_, response_);
|
| + EXPECT_EQ(expected_error_code_, response_error_code_);
|
| + if (response_error_code_ == net::OK) {
|
| + EXPECT_EQ(expected_status_code_, response_headers_->response_code());
|
| + EXPECT_EQ(expected_response_, response_);
|
| + }
|
| }
|
|
|
| void BuildComplicatedData(std::string* expected_result) {
|
| @@ -414,6 +418,7 @@ class BlobURLRequestJobTest : public testing::Test {
|
| scoped_refptr<net::HttpResponseHeaders> response_headers_;
|
| std::string response_metadata_;
|
|
|
| + int expected_error_code_;
|
| int expected_status_code_;
|
| std::string expected_response_;
|
| };
|
| @@ -449,14 +454,14 @@ TEST_F(BlobURLRequestJobTest, TestGetNonExistentFileRequest) {
|
| temp_file1_.InsertBeforeExtension(FILE_PATH_LITERAL("-na"));
|
| blob_data_->AppendFile(non_existent_file, 0,
|
| std::numeric_limits<uint64_t>::max(), base::Time());
|
| - TestErrorRequest(404);
|
| + TestErrorRequest(net::ERR_FILE_NOT_FOUND);
|
| }
|
|
|
| TEST_F(BlobURLRequestJobTest, TestGetChangedFileRequest) {
|
| base::Time old_time =
|
| temp_file_modification_time1_ - base::TimeDelta::FromSeconds(10);
|
| blob_data_->AppendFile(temp_file1_, 0, 3, old_time);
|
| - TestErrorRequest(404);
|
| + TestErrorRequest(net::ERR_FILE_NOT_FOUND);
|
| }
|
|
|
| TEST_F(BlobURLRequestJobTest, TestGetSlicedFileRequest) {
|
| @@ -495,7 +500,7 @@ TEST_F(BlobURLRequestJobTest, TestGetNonExistentFileSystemFileRequest) {
|
| GURL non_existent_file = GetFileSystemURL("non-existent.dat");
|
| blob_data_->AppendFileSystemFile(
|
| non_existent_file, 0, std::numeric_limits<uint64_t>::max(), base::Time());
|
| - TestErrorRequest(404);
|
| + TestErrorRequest(net::ERR_FILE_NOT_FOUND);
|
| }
|
|
|
| TEST_F(BlobURLRequestJobTest, TestGetInvalidFileSystemFileRequest) {
|
| @@ -503,7 +508,7 @@ TEST_F(BlobURLRequestJobTest, TestGetInvalidFileSystemFileRequest) {
|
| GURL invalid_file;
|
| blob_data_->AppendFileSystemFile(
|
| invalid_file, 0, std::numeric_limits<uint64_t>::max(), base::Time());
|
| - TestErrorRequest(500);
|
| + TestErrorRequest(net::ERR_FAILED);
|
| }
|
|
|
| TEST_F(BlobURLRequestJobTest, TestGetChangedFileSystemFileRequest) {
|
| @@ -511,7 +516,7 @@ TEST_F(BlobURLRequestJobTest, TestGetChangedFileSystemFileRequest) {
|
| base::Time old_time = temp_file_system_file_modification_time1_ -
|
| base::TimeDelta::FromSeconds(10);
|
| blob_data_->AppendFileSystemFile(temp_file_system_file1_, 0, 3, old_time);
|
| - TestErrorRequest(404);
|
| + TestErrorRequest(net::ERR_FILE_NOT_FOUND);
|
| }
|
|
|
| TEST_F(BlobURLRequestJobTest, TestGetSlicedFileSystemFileRequest) {
|
| @@ -657,7 +662,7 @@ TEST_F(BlobURLRequestJobTest, TestZeroSizeSideData) {
|
| TEST_F(BlobURLRequestJobTest, BrokenBlob) {
|
| blob_handle_ = blob_context_.AddBrokenBlob(
|
| "uuid", "", "", storage::BlobStatus::ERR_INVALID_CONSTRUCTION_ARGUMENTS);
|
| - TestErrorRequest(500);
|
| + TestErrorRequest(net::ERR_FAILED);
|
| }
|
|
|
| } // namespace content
|
|
|