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

Side by Side Diff: net/spdy/spdy_network_transaction_spdy3_unittest.cc

Issue 11778016: net: Stop using base::WorkerPool from UploadFileElementReader (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: _ Created 7 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 const HttpRequestInfo& CreateFilePostRequest() { 385 const HttpRequestInfo& CreateFilePostRequest() {
386 if (!google_post_request_initialized_) { 386 if (!google_post_request_initialized_) {
387 FilePath file_path; 387 FilePath file_path;
388 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 388 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
389 CHECK_EQ(static_cast<int>(kUploadDataSize), 389 CHECK_EQ(static_cast<int>(kUploadDataSize),
390 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 390 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
391 391
392 ScopedVector<UploadElementReader> element_readers; 392 ScopedVector<UploadElementReader> element_readers;
393 element_readers.push_back(new UploadFileElementReader( 393 element_readers.push_back(new UploadFileElementReader(
394 base::MessageLoopProxy::current(),
394 file_path, 0, kUploadDataSize, base::Time())); 395 file_path, 0, kUploadDataSize, base::Time()));
395 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 396 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
396 397
397 google_post_request_.method = "POST"; 398 google_post_request_.method = "POST";
398 google_post_request_.url = GURL(kDefaultURL); 399 google_post_request_.url = GURL(kDefaultURL);
399 google_post_request_.upload_data_stream = upload_data_stream_.get(); 400 google_post_request_.upload_data_stream = upload_data_stream_.get();
400 google_post_request_initialized_ = true; 401 google_post_request_initialized_ = true;
401 } 402 }
402 return google_post_request_; 403 return google_post_request_;
403 } 404 }
404 405
405 const HttpRequestInfo& CreateComplexPostRequest() { 406 const HttpRequestInfo& CreateComplexPostRequest() {
406 if (!google_post_request_initialized_) { 407 if (!google_post_request_initialized_) {
407 const int kFileRangeOffset = 1; 408 const int kFileRangeOffset = 1;
408 const int kFileRangeLength = 3; 409 const int kFileRangeLength = 3;
409 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); 410 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize);
410 411
411 FilePath file_path; 412 FilePath file_path;
412 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 413 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
413 CHECK_EQ(static_cast<int>(kUploadDataSize), 414 CHECK_EQ(static_cast<int>(kUploadDataSize),
414 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 415 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
415 416
416 ScopedVector<UploadElementReader> element_readers; 417 ScopedVector<UploadElementReader> element_readers;
417 element_readers.push_back( 418 element_readers.push_back(
418 new UploadBytesElementReader(kUploadData, kFileRangeOffset)); 419 new UploadBytesElementReader(kUploadData, kFileRangeOffset));
419 element_readers.push_back(new UploadFileElementReader( 420 element_readers.push_back(new UploadFileElementReader(
421 base::MessageLoopProxy::current(),
420 file_path, kFileRangeOffset, kFileRangeLength, base::Time())); 422 file_path, kFileRangeOffset, kFileRangeLength, base::Time()));
421 element_readers.push_back(new UploadBytesElementReader( 423 element_readers.push_back(new UploadBytesElementReader(
422 kUploadData + kFileRangeOffset + kFileRangeLength, 424 kUploadData + kFileRangeOffset + kFileRangeLength,
423 kUploadDataSize - (kFileRangeOffset + kFileRangeLength))); 425 kUploadDataSize - (kFileRangeOffset + kFileRangeLength)));
424 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 426 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
425 427
426 google_post_request_.method = "POST"; 428 google_post_request_.method = "POST";
427 google_post_request_.url = GURL(kDefaultURL); 429 google_post_request_.url = GURL(kDefaultURL);
428 google_post_request_.upload_data_stream = upload_data_stream_.get(); 430 google_post_request_.upload_data_stream = upload_data_stream_.get();
429 google_post_request_initialized_ = true; 431 google_post_request_initialized_ = true;
(...skipping 5925 matching lines...) Expand 10 before | Expand all | Expand 10 after
6355 // And now we can allow everything else to run to completion. 6357 // And now we can allow everything else to run to completion.
6356 data.SetStop(10); 6358 data.SetStop(10);
6357 data.Run(); 6359 data.Run();
6358 EXPECT_EQ(OK, callback2.WaitForResult()); 6360 EXPECT_EQ(OK, callback2.WaitForResult());
6359 EXPECT_EQ(OK, callback3.WaitForResult()); 6361 EXPECT_EQ(OK, callback3.WaitForResult());
6360 6362
6361 helper.VerifyDataConsumed(); 6363 helper.VerifyDataConsumed();
6362 } 6364 }
6363 6365
6364 } // namespace net 6366 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698