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

Side by Side Diff: content/browser/loader/resource_loader_unittest.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "base/files/file.h" 10 #include "base/files/file.h"
8 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
9 #include "base/location.h" 12 #include "base/location.h"
10 #include "base/macros.h" 13 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
13 #include "base/run_loop.h" 16 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
16 #include "content/browser/browser_thread_impl.h" 19 #include "content/browser/browser_thread_impl.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 488 }
486 489
487 private: 490 private:
488 scoped_ptr<net::ClientCertStore> dummy_cert_store_; 491 scoped_ptr<net::ClientCertStore> dummy_cert_store_;
489 }; 492 };
490 493
491 // Wraps a ChunkedUploadDataStream to behave as non-chunked to enable upload 494 // Wraps a ChunkedUploadDataStream to behave as non-chunked to enable upload
492 // progress reporting. 495 // progress reporting.
493 class NonChunkedUploadDataStream : public net::UploadDataStream { 496 class NonChunkedUploadDataStream : public net::UploadDataStream {
494 public: 497 public:
495 explicit NonChunkedUploadDataStream(uint64 size) 498 explicit NonChunkedUploadDataStream(uint64_t size)
496 : net::UploadDataStream(false, 0), stream_(0), size_(size) {} 499 : net::UploadDataStream(false, 0), stream_(0), size_(size) {}
497 500
498 void AppendData(const char* data) { 501 void AppendData(const char* data) {
499 stream_.AppendData(data, strlen(data), false); 502 stream_.AppendData(data, strlen(data), false);
500 } 503 }
501 504
502 private: 505 private:
503 int InitInternal() override { 506 int InitInternal() override {
504 SetSize(size_); 507 SetSize(size_);
505 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted, 508 stream_.Init(base::Bind(&NonChunkedUploadDataStream::OnInitCompleted,
506 base::Unretained(this))); 509 base::Unretained(this)));
507 return net::OK; 510 return net::OK;
508 } 511 }
509 512
510 int ReadInternal(net::IOBuffer* buf, int buf_len) override { 513 int ReadInternal(net::IOBuffer* buf, int buf_len) override {
511 return stream_.Read(buf, buf_len, 514 return stream_.Read(buf, buf_len,
512 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted, 515 base::Bind(&NonChunkedUploadDataStream::OnReadCompleted,
513 base::Unretained(this))); 516 base::Unretained(this)));
514 } 517 }
515 518
516 void ResetInternal() override { stream_.Reset(); } 519 void ResetInternal() override { stream_.Reset(); }
517 520
518 net::ChunkedUploadDataStream stream_; 521 net::ChunkedUploadDataStream stream_;
519 uint64 size_; 522 uint64_t size_;
520 523
521 DISALLOW_COPY_AND_ASSIGN(NonChunkedUploadDataStream); 524 DISALLOW_COPY_AND_ASSIGN(NonChunkedUploadDataStream);
522 }; 525 };
523 526
524 // Fails to create a temporary file with the given error. 527 // Fails to create a temporary file with the given error.
525 void CreateTemporaryError( 528 void CreateTemporaryError(
526 base::File::Error error, 529 base::File::Error error,
527 const CreateTemporaryFileStreamCallback& callback) { 530 const CreateTemporaryFileStreamCallback& callback) {
528 base::ThreadTaskRunnerHandle::Get()->PostTask( 531 base::ThreadTaskRunnerHandle::Get()->PostTask(
529 FROM_HERE, 532 FROM_HERE,
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 ASSERT_TRUE( 1146 ASSERT_TRUE(
1144 CertStore::GetInstance()->RetrieveCert(deserialized.cert_id, &cert)); 1147 CertStore::GetInstance()->RetrieveCert(deserialized.cert_id, &cert));
1145 EXPECT_TRUE(cert->Equals(GetTestCert().get())); 1148 EXPECT_TRUE(cert->Equals(GetTestCert().get()));
1146 1149
1147 EXPECT_EQ(kTestCertError, deserialized.cert_status); 1150 EXPECT_EQ(kTestCertError, deserialized.cert_status);
1148 EXPECT_EQ(kTestConnectionStatus, deserialized.connection_status); 1151 EXPECT_EQ(kTestConnectionStatus, deserialized.connection_status);
1149 EXPECT_EQ(kTestSecurityBits, deserialized.security_bits); 1152 EXPECT_EQ(kTestSecurityBits, deserialized.security_bits);
1150 } 1153 }
1151 1154
1152 } // namespace content 1155 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader.h ('k') | content/browser/loader/resource_message_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698