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

Side by Side Diff: net/spdy/spdy_network_transaction_spdy2_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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 415
416 const HttpRequestInfo& CreateFilePostRequest() { 416 const HttpRequestInfo& CreateFilePostRequest() {
417 if (!google_post_request_initialized_) { 417 if (!google_post_request_initialized_) {
418 base::FilePath file_path; 418 base::FilePath file_path;
419 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 419 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
420 CHECK_EQ(static_cast<int>(kUploadDataSize), 420 CHECK_EQ(static_cast<int>(kUploadDataSize),
421 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 421 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
422 422
423 ScopedVector<UploadElementReader> element_readers; 423 ScopedVector<UploadElementReader> element_readers;
424 element_readers.push_back(new UploadFileElementReader( 424 element_readers.push_back(
425 base::MessageLoopProxy::current(), 425 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
426 file_path, 0, kUploadDataSize, base::Time())); 426 file_path,
427 0,
428 kUploadDataSize,
429 base::Time()));
427 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 430 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
428 431
429 google_post_request_.method = "POST"; 432 google_post_request_.method = "POST";
430 google_post_request_.url = GURL(kDefaultURL); 433 google_post_request_.url = GURL(kDefaultURL);
431 google_post_request_.upload_data_stream = upload_data_stream_.get(); 434 google_post_request_.upload_data_stream = upload_data_stream_.get();
432 google_post_request_initialized_ = true; 435 google_post_request_initialized_ = true;
433 } 436 }
434 return google_post_request_; 437 return google_post_request_;
435 } 438 }
436 439
437 const HttpRequestInfo& CreateComplexPostRequest() { 440 const HttpRequestInfo& CreateComplexPostRequest() {
438 if (!google_post_request_initialized_) { 441 if (!google_post_request_initialized_) {
439 const int kFileRangeOffset = 1; 442 const int kFileRangeOffset = 1;
440 const int kFileRangeLength = 3; 443 const int kFileRangeLength = 3;
441 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); 444 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize);
442 445
443 base::FilePath file_path; 446 base::FilePath file_path;
444 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 447 CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
445 CHECK_EQ(static_cast<int>(kUploadDataSize), 448 CHECK_EQ(static_cast<int>(kUploadDataSize),
446 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 449 file_util::WriteFile(file_path, kUploadData, kUploadDataSize));
447 450
448 ScopedVector<UploadElementReader> element_readers; 451 ScopedVector<UploadElementReader> element_readers;
449 element_readers.push_back( 452 element_readers.push_back(
450 new UploadBytesElementReader(kUploadData, kFileRangeOffset)); 453 new UploadBytesElementReader(kUploadData, kFileRangeOffset));
451 element_readers.push_back(new UploadFileElementReader( 454 element_readers.push_back(
452 base::MessageLoopProxy::current(), 455 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
453 file_path, kFileRangeOffset, kFileRangeLength, base::Time())); 456 file_path,
457 kFileRangeOffset,
458 kFileRangeLength,
459 base::Time()));
454 element_readers.push_back(new UploadBytesElementReader( 460 element_readers.push_back(new UploadBytesElementReader(
455 kUploadData + kFileRangeOffset + kFileRangeLength, 461 kUploadData + kFileRangeOffset + kFileRangeLength,
456 kUploadDataSize - (kFileRangeOffset + kFileRangeLength))); 462 kUploadDataSize - (kFileRangeOffset + kFileRangeLength)));
457 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0)); 463 upload_data_stream_.reset(new UploadDataStream(&element_readers, 0));
458 464
459 google_post_request_.method = "POST"; 465 google_post_request_.method = "POST";
460 google_post_request_.url = GURL(kDefaultURL); 466 google_post_request_.url = GURL(kDefaultURL);
461 google_post_request_.upload_data_stream = upload_data_stream_.get(); 467 google_post_request_.upload_data_stream = upload_data_stream_.get();
462 google_post_request_initialized_ = true; 468 google_post_request_initialized_ = true;
463 } 469 }
(...skipping 5471 matching lines...) Expand 10 before | Expand all | Expand 10 after
5935 // And now we can allow everything else to run to completion. 5941 // And now we can allow everything else to run to completion.
5936 data.SetStop(10); 5942 data.SetStop(10);
5937 data.Run(); 5943 data.Run();
5938 EXPECT_EQ(OK, callback2.WaitForResult()); 5944 EXPECT_EQ(OK, callback2.WaitForResult());
5939 EXPECT_EQ(OK, callback3.WaitForResult()); 5945 EXPECT_EQ(OK, callback3.WaitForResult());
5940 5946
5941 helper.VerifyDataConsumed(); 5947 helper.VerifyDataConsumed();
5942 } 5948 }
5943 5949
5944 } // namespace net 5950 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_nss.cc ('k') | net/spdy/spdy_network_transaction_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698