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

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

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 google_post_request_initialized_ = true; 442 google_post_request_initialized_ = true;
443 } 443 }
444 return google_post_request_; 444 return google_post_request_;
445 } 445 }
446 446
447 const HttpRequestInfo& CreateFilePostRequest() { 447 const HttpRequestInfo& CreateFilePostRequest() {
448 if (!google_post_request_initialized_) { 448 if (!google_post_request_initialized_) {
449 base::FilePath file_path; 449 base::FilePath file_path;
450 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 450 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
451 CHECK_EQ(static_cast<int>(kUploadDataSize), 451 CHECK_EQ(static_cast<int>(kUploadDataSize),
452 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 452 base::WriteFile(file_path, kUploadData, kUploadDataSize));
453 453
454 ScopedVector<UploadElementReader> element_readers; 454 ScopedVector<UploadElementReader> element_readers;
455 element_readers.push_back( 455 element_readers.push_back(
456 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 456 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
457 file_path, 457 file_path,
458 0, 458 0,
459 kUploadDataSize, 459 kUploadDataSize,
460 base::Time())); 460 base::Time()));
461 upload_data_stream_.reset( 461 upload_data_stream_.reset(
462 new UploadDataStream(element_readers.Pass(), 0)); 462 new UploadDataStream(element_readers.Pass(), 0));
463 463
464 google_post_request_.method = "POST"; 464 google_post_request_.method = "POST";
465 google_post_request_.url = GURL(kDefaultURL); 465 google_post_request_.url = GURL(kDefaultURL);
466 google_post_request_.upload_data_stream = upload_data_stream_.get(); 466 google_post_request_.upload_data_stream = upload_data_stream_.get();
467 google_post_request_initialized_ = true; 467 google_post_request_initialized_ = true;
468 } 468 }
469 return google_post_request_; 469 return google_post_request_;
470 } 470 }
471 471
472 const HttpRequestInfo& CreateUnreadableFilePostRequest() { 472 const HttpRequestInfo& CreateUnreadableFilePostRequest() {
473 if (google_post_request_initialized_) 473 if (google_post_request_initialized_)
474 return google_post_request_; 474 return google_post_request_;
475 475
476 base::FilePath file_path; 476 base::FilePath file_path;
477 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 477 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
478 CHECK_EQ(static_cast<int>(kUploadDataSize), 478 CHECK_EQ(static_cast<int>(kUploadDataSize),
479 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 479 base::WriteFile(file_path, kUploadData, kUploadDataSize));
480 CHECK(file_util::MakeFileUnreadable(file_path)); 480 CHECK(file_util::MakeFileUnreadable(file_path));
481 481
482 ScopedVector<UploadElementReader> element_readers; 482 ScopedVector<UploadElementReader> element_readers;
483 element_readers.push_back( 483 element_readers.push_back(
484 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 484 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
485 file_path, 485 file_path,
486 0, 486 0,
487 kUploadDataSize, 487 kUploadDataSize,
488 base::Time())); 488 base::Time()));
489 upload_data_stream_.reset( 489 upload_data_stream_.reset(
490 new UploadDataStream(element_readers.Pass(), 0)); 490 new UploadDataStream(element_readers.Pass(), 0));
491 491
492 google_post_request_.method = "POST"; 492 google_post_request_.method = "POST";
493 google_post_request_.url = GURL(kDefaultURL); 493 google_post_request_.url = GURL(kDefaultURL);
494 google_post_request_.upload_data_stream = upload_data_stream_.get(); 494 google_post_request_.upload_data_stream = upload_data_stream_.get();
495 google_post_request_initialized_ = true; 495 google_post_request_initialized_ = true;
496 return google_post_request_; 496 return google_post_request_;
497 } 497 }
498 498
499 const HttpRequestInfo& CreateComplexPostRequest() { 499 const HttpRequestInfo& CreateComplexPostRequest() {
500 if (!google_post_request_initialized_) { 500 if (!google_post_request_initialized_) {
501 const int kFileRangeOffset = 1; 501 const int kFileRangeOffset = 1;
502 const int kFileRangeLength = 3; 502 const int kFileRangeLength = 3;
503 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); 503 CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize);
504 504
505 base::FilePath file_path; 505 base::FilePath file_path;
506 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); 506 CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path));
507 CHECK_EQ(static_cast<int>(kUploadDataSize), 507 CHECK_EQ(static_cast<int>(kUploadDataSize),
508 file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); 508 base::WriteFile(file_path, kUploadData, kUploadDataSize));
509 509
510 ScopedVector<UploadElementReader> element_readers; 510 ScopedVector<UploadElementReader> element_readers;
511 element_readers.push_back( 511 element_readers.push_back(
512 new UploadBytesElementReader(kUploadData, kFileRangeOffset)); 512 new UploadBytesElementReader(kUploadData, kFileRangeOffset));
513 element_readers.push_back( 513 element_readers.push_back(
514 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 514 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
515 file_path, 515 file_path,
516 kFileRangeOffset, 516 kFileRangeOffset,
517 kFileRangeLength, 517 kFileRangeLength,
518 base::Time())); 518 base::Time()));
(...skipping 5983 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 // since we're send-stalled. 6502 // since we're send-stalled.
6503 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); 6503 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control());
6504 6504
6505 // Read in WINDOW_UPDATE or SETTINGS frame. 6505 // Read in WINDOW_UPDATE or SETTINGS frame.
6506 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); 6506 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7);
6507 rv = callback.WaitForResult(); 6507 rv = callback.WaitForResult();
6508 helper.VerifyDataConsumed(); 6508 helper.VerifyDataConsumed();
6509 } 6509 }
6510 6510
6511 } // namespace net 6511 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux_unittest.cc ('k') | net/tools/crl_set_dump/crl_set_dump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698