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

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

Issue 2229313002: Make FetchDataLoader accept BytesConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-c++-rs
Patch Set: fix Created 4 years, 4 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/BodyStreamBufferTest.cpp
diff --git a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
index a4efa2f80da474b2f71919062f8e924693a933d1..f969ce6aa5f7633b76e955fd8f068dc6362a2286 100644
--- a/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp
@@ -81,8 +81,8 @@ TEST_F(BodyStreamBufferTest, Tee)
EXPECT_CALL(checkpoint, Call(1));
EXPECT_CALL(*client1, didFetchDataLoadedString(String("hello, world")));
EXPECT_CALL(checkpoint, Call(2));
- EXPECT_CALL(checkpoint, Call(3));
EXPECT_CALL(*client2, didFetchDataLoadedString(String("hello, world")));
+ EXPECT_CALL(checkpoint, Call(3));
EXPECT_CALL(checkpoint, Call(4));
std::unique_ptr<DataConsumerHandleTestUtil::ReplayingHandle> handle = DataConsumerHandleTestUtil::ReplayingHandle::create();
@@ -292,6 +292,7 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsArrayBuffer)
EXPECT_CALL(checkpoint, Call(2));
std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create();
+ handle->add(Command(Command::Wait));
handle->add(Command(Command::Data, "hello"));
handle->add(Command(Command::Done));
BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle)));
@@ -325,6 +326,7 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsBlob)
EXPECT_CALL(checkpoint, Call(2));
std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create();
+ handle->add(Command(Command::Wait));
handle->add(Command(Command::Data, "hello"));
handle->add(Command(Command::Done));
BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle)));
@@ -356,6 +358,7 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsString)
EXPECT_CALL(checkpoint, Call(2));
std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create();
+ handle->add(Command(Command::Wait));
handle->add(Command(Command::Data, "hello"));
handle->add(Command(Command::Done));
BodyStreamBuffer* buffer = new BodyStreamBuffer(scope.getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle)));
@@ -395,13 +398,8 @@ TEST_F(BodyStreamBufferTest, LoadClosedHandle)
EXPECT_FALSE(buffer->isStreamDisturbed());
EXPECT_FALSE(buffer->hasPendingActivity());
- buffer->startLoading(FetchDataLoader::createLoaderAsString(), client);
- EXPECT_TRUE(buffer->isStreamLocked());
- EXPECT_TRUE(buffer->isStreamDisturbed());
- EXPECT_TRUE(buffer->hasPendingActivity());
-
checkpoint.Call(1);
- testing::runPendingTasks();
+ buffer->startLoading(FetchDataLoader::createLoaderAsString(), client);
checkpoint.Call(2);
EXPECT_TRUE(buffer->isStreamLocked());
@@ -429,13 +427,9 @@ TEST_F(BodyStreamBufferTest, LoadErroredHandle)
EXPECT_FALSE(buffer->isStreamLocked());
EXPECT_FALSE(buffer->isStreamDisturbed());
EXPECT_FALSE(buffer->hasPendingActivity());
- buffer->startLoading(FetchDataLoader::createLoaderAsString(), client);
- EXPECT_TRUE(buffer->isStreamLocked());
- EXPECT_TRUE(buffer->isStreamDisturbed());
- EXPECT_TRUE(buffer->hasPendingActivity());
checkpoint.Call(1);
- testing::runPendingTasks();
+ buffer->startLoading(FetchDataLoader::createLoaderAsString(), client);
checkpoint.Call(2);
EXPECT_TRUE(buffer->isStreamLocked());
@@ -455,6 +449,7 @@ TEST_F(BodyStreamBufferTest, LoaderShouldBeKeptAliveByBodyStreamBuffer)
EXPECT_CALL(checkpoint, Call(2));
std::unique_ptr<ReplayingHandle> handle = ReplayingHandle::create();
+ handle->add(Command(Command::Wait));
handle->add(Command(Command::Data, "hello"));
handle->add(Command(Command::Done));
Persistent<BodyStreamBuffer> buffer = new BodyStreamBuffer(scope.getScriptState(), createFetchDataConsumerHandleFromWebHandle(std::move(handle)));
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp ('k') | third_party/WebKit/Source/modules/fetch/BytesConsumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698