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

Unified Diff: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc

Issue 2528243002: Fix silent truncations when extracting values from CheckedNumeric (Closed)
Patch Set: compile fix Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/numerics/safe_numerics_unittest.cc ('k') | chrome/utility/safe_browsing/mac/hfs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
index 2a2f2f733ff14cb876aa9592dcc0682be13281f9..09fcf7715bf1f94767d64753e0e9841318876f23 100644
--- a/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader_unittest.cc
@@ -132,7 +132,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_AllAtOnce) {
FileStreamReader reader(NULL, file_url_, initial_offset,
*fake_file_->metadata->modification_time);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(
- base::CheckedNumeric<size_t>(*fake_file_->metadata->size).ValueOrDie()));
+ base::checked_cast<size_t>(*fake_file_->metadata->size)));
const int result =
reader.Read(io_buffer.get(), *fake_file_->metadata->size,
@@ -155,7 +155,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_WrongFile) {
FileStreamReader reader(NULL, wrong_file_url_, initial_offset,
*fake_file_->metadata->modification_time);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(
- base::CheckedNumeric<size_t>(*fake_file_->metadata->size).ValueOrDie()));
+ base::checked_cast<size_t>(*fake_file_->metadata->size)));
const int result =
reader.Read(io_buffer.get(), *fake_file_->metadata->size,
@@ -250,7 +250,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_ModifiedFile) {
FileStreamReader reader(NULL, file_url_, initial_offset, base::Time::Max());
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(
- base::CheckedNumeric<size_t>(*fake_file_->metadata->size).ValueOrDie()));
+ base::checked_cast<size_t>(*fake_file_->metadata->size)));
const int result =
reader.Read(io_buffer.get(), *fake_file_->metadata->size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
@@ -269,7 +269,7 @@ TEST_F(FileSystemProviderFileStreamReader, Read_ExpectedModificationTimeNull) {
FileStreamReader reader(NULL, file_url_, initial_offset, base::Time());
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(
- base::CheckedNumeric<size_t>(*fake_file_->metadata->size).ValueOrDie()));
+ base::checked_cast<size_t>(*fake_file_->metadata->size)));
const int result =
reader.Read(io_buffer.get(), *fake_file_->metadata->size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
« no previous file with comments | « base/numerics/safe_numerics_unittest.cc ('k') | chrome/utility/safe_browsing/mac/hfs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698