Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Unified Diff: content/browser/fileapi/blob_url_request_job_unittest.cc

Issue 1376123002: Revert of [Blob] BlobReader class & tests, and removal of all redundant reading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 96becf0de0935ae062abb6c67546b526fc088cd6..9debd4dc6715caf70b602336f2a6d713a3734665 100644
--- a/content/browser/fileapi/blob_url_request_job_unittest.cc
+++ b/content/browser/fileapi/blob_url_request_job_unittest.cc
@@ -115,7 +115,7 @@
net::URLRequest* request,
net::NetworkDelegate* network_delegate) const override {
return new BlobURLRequestJob(request, network_delegate,
- test_->GetHandleFromBuilder(),
+ test_->GetSnapshotFromBuilder(),
test_->file_system_context_.get(),
base::ThreadTaskRunnerHandle::Get().get());
}
@@ -157,7 +157,6 @@
void TearDown() override {
blob_handle_.reset();
- request_.reset();
// Clean up for ASAN
base::RunLoop run_loop;
run_loop.RunUntilIdle();
@@ -283,19 +282,18 @@
*expected_result += std::string(kTestFileSystemFileData2 + 6, 7);
}
- storage::BlobDataHandle* GetHandleFromBuilder() {
+ scoped_ptr<BlobDataSnapshot> GetSnapshotFromBuilder() {
if (!blob_handle_) {
blob_handle_ = blob_context_.AddFinishedBlob(blob_data_.get()).Pass();
}
- return blob_handle_.get();
+ return blob_handle_->CreateSnapshot().Pass();
}
// This only works if all the Blob items have a definite pre-computed length.
// Otherwise, this will fail a CHECK.
int64 GetTotalBlobLength() {
int64 total = 0;
- scoped_ptr<BlobDataSnapshot> data =
- GetHandleFromBuilder()->CreateSnapshot();
+ scoped_ptr<BlobDataSnapshot> data = GetSnapshotFromBuilder();
const auto& items = data->items();
for (const auto& item : items) {
int64 length = base::checked_cast<int64>(item->length());
@@ -493,27 +491,6 @@
EXPECT_EQ(total, length);
}
-TEST_F(BlobURLRequestJobTest, TestGetRangeRequest3) {
- SetUpFileSystem();
- std::string result;
- BuildComplicatedData(&result);
- net::HttpRequestHeaders extra_headers;
- extra_headers.SetHeader(net::HttpRequestHeaders::kRange,
- net::HttpByteRange::Bounded(0, 2).GetHeaderValue());
- expected_status_code_ = 206;
- expected_response_ = result.substr(0, 3);
- TestRequest("GET", extra_headers);
-
- EXPECT_EQ(3, request_->response_headers()->GetContentLength());
-
- int64 first = 0, last = 0, length = 0;
- EXPECT_TRUE(
- request_->response_headers()->GetContentRange(&first, &last, &length));
- EXPECT_EQ(0, first);
- EXPECT_EQ(2, last);
- EXPECT_EQ(GetTotalBlobLength(), length);
-}
-
TEST_F(BlobURLRequestJobTest, TestExtraHeaders) {
blob_data_->set_content_type(kTestContentType);
blob_data_->set_content_disposition(kTestContentDisposition);
« no previous file with comments | « content/browser/fileapi/blob_reader_unittest.cc ('k') | content/browser/loader/upload_data_stream_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698