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

Unified Diff: content/browser/blob_storage/blob_reader_unittest.cc

Issue 2000483004: [BlobReader] Correct IsInMemory = false when async constructing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests, and comment Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/upload_element_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/blob_storage/blob_reader_unittest.cc
diff --git a/content/browser/blob_storage/blob_reader_unittest.cc b/content/browser/blob_storage/blob_reader_unittest.cc
index 8c2fe4107a27e55a7dbeb6bbb05a79b91da59d45..07de8e208aef627c923606a27ff1ce3dc72377a0 100644
--- a/content/browser/blob_storage/blob_reader_unittest.cc
+++ b/content/browser/blob_storage/blob_reader_unittest.cc
@@ -424,6 +424,7 @@ TEST_F(BlobReaderTest, BasicMemory) {
EXPECT_FALSE(IsReaderTotalSizeCalculated());
EXPECT_EQ(BlobReader::Status::DONE,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_TRUE(reader_->IsInMemory());
CheckSizeCalculatedSynchronously(kDataSize, size_result);
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kDataSize));
@@ -454,6 +455,7 @@ TEST_F(BlobReaderTest, BasicFile) {
EXPECT_FALSE(IsReaderTotalSizeCalculated());
EXPECT_EQ(BlobReader::Status::DONE,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_FALSE(reader_->IsInMemory());
CheckSizeCalculatedSynchronously(kData.size(), size_result);
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kData.size()));
@@ -476,7 +478,6 @@ TEST_F(BlobReaderTest, BasicFileSystem) {
const base::Time kTime = base::Time::Now();
b.AppendFileSystemFile(kURL, 0, kData.size(), kTime);
this->InitializeReader(&b);
-
// Non-async reader.
ExpectFileSystemCall(kURL, 0, kData.size(), kTime,
new FakeFileStreamReader(kData));
@@ -485,6 +486,8 @@ TEST_F(BlobReaderTest, BasicFileSystem) {
EXPECT_FALSE(IsReaderTotalSizeCalculated());
EXPECT_EQ(BlobReader::Status::DONE,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_FALSE(reader_->IsInMemory());
+
CheckSizeCalculatedSynchronously(kData.size(), size_result);
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kData.size()));
@@ -719,6 +722,7 @@ TEST_F(BlobReaderTest, FileAsync) {
EXPECT_FALSE(IsReaderTotalSizeCalculated());
EXPECT_EQ(BlobReader::Status::IO_PENDING,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_FALSE(reader_->IsInMemory());
CheckSizeNotCalculatedYet(size_result);
message_loop_.RunUntilIdle();
CheckSizeCalculatedAsynchronously(kData.size(), size_result);
@@ -755,6 +759,7 @@ TEST_F(BlobReaderTest, FileSystemAsync) {
EXPECT_EQ(BlobReader::Status::IO_PENDING,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
CheckSizeNotCalculatedYet(size_result);
+ EXPECT_FALSE(reader_->IsInMemory());
message_loop_.RunUntilIdle();
CheckSizeCalculatedAsynchronously(kData.size(), size_result);
@@ -1178,6 +1183,7 @@ TEST_F(BlobReaderTest, HandleBeforeAsyncCancel) {
int size_result = -1;
EXPECT_EQ(BlobReader::Status::IO_PENDING,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_FALSE(reader_->IsInMemory());
context_.CancelPendingBlob(kUuid, IPCBlobCreationCancelCode::UNKNOWN);
message_loop_.RunUntilIdle();
EXPECT_EQ(net::ERR_FAILED, size_result);
@@ -1198,6 +1204,7 @@ TEST_F(BlobReaderTest, ReadFromIncompleteBlob) {
int size_result = -1;
EXPECT_EQ(BlobReader::Status::IO_PENDING,
reader_->CalculateSize(base::Bind(&SetValue<int>, &size_result)));
+ EXPECT_FALSE(reader_->IsInMemory());
context_.CompletePendingBlob(b);
message_loop_.RunUntilIdle();
CheckSizeCalculatedAsynchronously(kDataSize, size_result);
« no previous file with comments | « no previous file | net/base/upload_element_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698