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

Unified Diff: third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp

Issue 2319093004: Revert of [Fetch API] Start reading blob only when the reader wants to read contents. (Closed)
Patch Set: Created 4 years, 3 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
Index: third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
index a7f6a85451c8baf143e87cbb463802a025418a6d..b49316cadfc7d072962900eae4f12073d30c9d11 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchBlobDataConsumerHandleTest.cpp
@@ -112,9 +112,8 @@
= FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory);
testing::runPendingTasks();
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -135,27 +134,6 @@
EXPECT_EQ(NotCORSEnabled, resourceLoaderOptions.corsEnabled);
}
-TEST_F(FetchBlobDataConsumerHandleTest, ZeroByteReadDoesNotCreateLoader)
-{
- auto factory = new StrictMock<MockLoaderFactory>;
- Checkpoint checkpoint;
-
- InSequence s;
- EXPECT_CALL(checkpoint, Call(1));
- EXPECT_CALL(checkpoint, Call(2));
-
- RefPtr<BlobDataHandle> blobDataHandle = createBlobDataHandle("Once upon a time");
- std::unique_ptr<WebDataConsumerHandle> handle
- = FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory);
- testing::runPendingTasks();
-
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size));
- checkpoint.Call(1);
- testing::runPendingTasks();
- checkpoint.Call(2);
-}
-
TEST_F(FetchBlobDataConsumerHandleTest, CancelLoaderWhenStopped)
{
auto factory = new StrictMock<MockLoaderFactory>;
@@ -176,9 +154,8 @@
= FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory);
testing::runPendingTasks();
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -208,9 +185,8 @@
std::unique_ptr<WebDataConsumerHandle::Reader> reader = handle->obtainReader(nullptr);
testing::runPendingTasks();
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, reader->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ reader->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -247,9 +223,8 @@
src->add(Command(Command::Wait));
src->add(Command(Command::Done));
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -286,9 +261,8 @@
src->add(Command(Command::Wait));
src->add(Command(Command::Done));
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -317,9 +291,8 @@
std::unique_ptr<WebDataConsumerHandle> handle
= FetchBlobDataConsumerHandle::create(&document(), blobDataHandle, factory);
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);
@@ -353,9 +326,8 @@
src->add(Command(Command::Data, "hello, "));
src->add(Command(Command::Error));
- char buffer[1];
- size_t size = 0;
- ASSERT_EQ(kShouldWait, handle->obtainReader(nullptr)->read(buffer, sizeof(buffer), kNone, &size));
+ size_t size = 0;
+ handle->obtainReader(nullptr)->read(nullptr, 0, kNone, &size);
checkpoint.Call(1);
testing::runPendingTasks();
checkpoint.Call(2);

Powered by Google App Engine
This is Rietveld 408576698