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

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

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 | Annotate | Revision Log
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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 416 }
417 417
418 const HttpRequestInfo& CreateFilePostRequest() { 418 const HttpRequestInfo& CreateFilePostRequest() {
419 if (!google_post_request_initialized_) { 419 if (!google_post_request_initialized_) {
420 base::FilePath file_path; 420 base::FilePath file_path;
421 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 421 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
422 CHECK_EQ(static_cast<int>(kUploadDataSize), 422 CHECK_EQ(static_cast<int>(kUploadDataSize),
423 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 423 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
424 424
425 ScopedVector<UploadElementReader> element_readers; 425 ScopedVector<UploadElementReader> element_readers;
426 element_readers.push_back(new UploadFileElementReader( 426 element_readers.push_back(
427 base::MessageLoopProxy::current(), 427 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
428 file_path, 0, kUploadDataSize, base::Time())); 428 file_path,
429 0,
430 kUploadDataSize,
431 base::Time()));
429 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 432 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
430 433
431 google_post_request_.method = "POST"; 434 google_post_request_.method = "POST";
432 google_post_request_.url = GURL(kDefaultURL); 435 google_post_request_.url = GURL(kDefaultURL);
433 google_post_request_.upload_data_stream = upload_data_stream_.get(); 436 google_post_request_.upload_data_stream = upload_data_stream_.get();
434 google_post_request_initialized_ = true; 437 google_post_request_initialized_ = true;
435 } 438 }
436 return google_post_request_; 439 return google_post_request_;
437 } 440 }
438 441
439 const HttpRequestInfo& CreateComplexPostRequest() { 442 const HttpRequestInfo& CreateComplexPostRequest() {
440 if (!google_post_request_initialized_) { 443 if (!google_post_request_initialized_) {
441 const int kFileRangeOffset = 1; 444 const int kFileRangeOffset = 1;
442 const int kFileRangeLength = 3; 445 const int kFileRangeLength = 3;
443 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); 446 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize);
444 447
445 base::FilePath file_path; 448 base::FilePath file_path;
446 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 449 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
447 CHECK_EQ(static_cast<int>(kUploadDataSize), 450 CHECK_EQ(static_cast<int>(kUploadDataSize),
448 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 451 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
449 452
450 ScopedVector<UploadElementReader> element_readers; 453 ScopedVector<UploadElementReader> element_readers;
451 element_readers.push_back( 454 element_readers.push_back(
452 new UploadBytesElementReader(kUploadData, kFileRangeOffset)); 455 new UploadBytesElementReader(kUploadData, kFileRangeOffset));
453 element_readers.push_back(new UploadFileElementReader( 456 element_readers.push_back(
454 base::MessageLoopProxy::current(), 457 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
455 file_path, kFileRangeOffset, kFileRangeLength, base::Time())); 458 file_path,
459 kFileRangeOffset,
460 kFileRangeLength,
461 base::Time()));
456 element_readers.push_back(new UploadBytesElementReader( 462 element_readers.push_back(new UploadBytesElementReader(
457 kUploadData + kFileRangeOffset + kFileRangeLength, 463 kUploadData + kFileRangeOffset + kFileRangeLength,
458 kUploadDataSize - (kFileRangeOffset + kFileRangeLength))); 464 kUploadDataSize - (kFileRangeOffset + kFileRangeLength)));
459 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 465 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
460 466
461 google_post_request_.method = "POST"; 467 google_post_request_.method = "POST";
462 google_post_request_.url = GURL(kDefaultURL); 468 google_post_request_.url = GURL(kDefaultURL);
463 google_post_request_.upload_data_stream = upload_data_stream_.get(); 469 google_post_request_.upload_data_stream = upload_data_stream_.get();
464 google_post_request_initialized_ = true; 470 google_post_request_initialized_ = true;
465 } 471 }
(...skipping 6068 matching lines...) Expand 10 before | Expand all | Expand 10 after
6534 // And now we can allow everything else to run to completion. 6540 // And now we can allow everything else to run to completion.
6535 data.SetStop(10); 6541 data.SetStop(10);
6536 data.Run(); 6542 data.Run();
6537 EXPECT_EQ(OK, callback2.WaitForResult()); 6543 EXPECT_EQ(OK, callback2.WaitForResult());
6538 EXPECT_EQ(OK, callback3.WaitForResult()); 6544 EXPECT_EQ(OK, callback3.WaitForResult());
6539 6545
6540 helper.VerifyDataConsumed(); 6546 helper.VerifyDataConsumed();
6541 } 6547 }
6542 6548
6543 } // namespace net 6549 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_spdy2_unittest.cc ('k') | net/tools/crash_cache/crash_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698