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

Unified Diff: webkit/blob/blob_url_request_job_unittest.cc

Issue 6612051: In BlobURLRequestJob, open files asynchronously to avoid blocking the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added DCHECK, merged with trunk Created 9 years, 9 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
« no previous file with comments | « webkit/blob/blob_url_request_job.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_url_request_job_unittest.cc
diff --git a/webkit/blob/blob_url_request_job_unittest.cc b/webkit/blob/blob_url_request_job_unittest.cc
index 1d7cd6cc2b4a8610b66fd379a1b89131d4c1e664..5d318a3022c4a170f675b8f1925a2f371fd3d85b 100644
--- a/webkit/blob/blob_url_request_job_unittest.cc
+++ b/webkit/blob/blob_url_request_job_unittest.cc
@@ -7,6 +7,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/message_loop_proxy.h"
#include "base/scoped_temp_dir.h"
#include "base/task.h"
#include "base/threading/thread.h"
@@ -249,8 +250,10 @@ class BlobURLRequestJobTest : public testing::Test {
request_.reset(new net::URLRequest(GURL("blob:blah"),
url_request_delegate_.get()));
request_->set_method(method);
- blob_url_request_job_ = new BlobURLRequestJob(request_.get(),
- blob_data, NULL);
+ blob_url_request_job_ = new BlobURLRequestJob(
+ request_.get(),
+ blob_data,
+ base::MessageLoopProxy::CreateForCurrentThread());
// Start the request.
if (!extra_headers.IsEmpty())
@@ -283,6 +286,20 @@ class BlobURLRequestJobTest : public testing::Test {
TestSuccessRequest(blob_data, kTestFileData1);
}
+ void TestGetLargeFileRequest() {
+ scoped_refptr<BlobData> blob_data(new BlobData());
+ FilePath large_temp_file = temp_dir_.path().AppendASCII("LargeBlob.dat");
+ std::string large_data;
+ large_data.reserve(kBufferSize * 5);
+ for (int i = 0; i < kBufferSize * 5; ++i)
+ large_data.append(1, static_cast<char>(i % 256));
+ ASSERT_EQ(static_cast<int>(large_data.size()),
+ file_util::WriteFile(large_temp_file, large_data.data(),
+ large_data.size()));
+ blob_data->AppendFile(large_temp_file, 0, -1, base::Time());
+ TestSuccessRequest(blob_data, large_data);
+ }
+
void TestGetNonExistentFileRequest() {
FilePath non_existent_file =
temp_file1_.InsertBeforeExtension(FILE_PATH_LITERAL("-na"));
@@ -409,6 +426,10 @@ TEST_F(BlobURLRequestJobTest, TestGetSimpleFileRequest) {
RunTestOnIOThread(&BlobURLRequestJobTest::TestGetSimpleFileRequest);
}
+TEST_F(BlobURLRequestJobTest, TestGetLargeFileRequest) {
+ RunTestOnIOThread(&BlobURLRequestJobTest::TestGetLargeFileRequest);
+}
+
TEST_F(BlobURLRequestJobTest, TestGetSlicedDataRequest) {
RunTestOnIOThread(&BlobURLRequestJobTest::TestGetSlicedDataRequest);
}
« no previous file with comments | « webkit/blob/blob_url_request_job.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698