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

Unified Diff: third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp

Issue 1710733002: Move multipart resource handling to core/fetch (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-cleanup
Patch Set: Created 4 years, 9 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/core/fetch/MultipartImageResourceParserTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp b/third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp
index 6fb132fe6b249c8d9d109457de11171aab7c9211..184e9de494a24d6e873f6b2b1d823931c829a767 100644
--- a/third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/MultipartImageResourceParserTest.cpp
@@ -29,8 +29,11 @@ class MockClient final : public NoBaseWillBeGarbageCollectedFinalized<MockClient
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockClient);
public:
- void onePartInMultipartReceived(const ResourceResponse& response) override
+ void onePartInMultipartReceived(const ResourceResponse& response, bool isFirstPart) override
{
+ if (isFirstPart != m_responses.isEmpty())
+ FAIL() << "m_responses.size() = " << m_responses.size() << ", isFirstPart = " << isFirstPart;
+
m_responses.append(response);
m_data.append(Vector<char>());
}
@@ -442,7 +445,7 @@ TEST(MultipartResponseTest, MultipleBoundaries)
EXPECT_EQ("foofoo", toString(client->m_data[1]));
}
-TEST(MultipartResponseTest, MultipartPayloadSet)
+TEST(MultipartResponseTest, IsFirstPartSet)
{
ResourceResponse response;
response.setMimeType("multipart/x-mixed-replace");
@@ -452,6 +455,7 @@ TEST(MultipartResponseTest, MultipartPayloadSet)
MultipartImageResourceParser* parser = new MultipartImageResourceParser(response, boundary, client);
+ // isFirstPart is checked at MockClient::didReceiveResponse.
const char data[] =
"--bound\n"
"Content-type: text/plain\n\n"
@@ -461,7 +465,6 @@ TEST(MultipartResponseTest, MultipartPayloadSet)
ASSERT_EQ(1u, client->m_responses.size());
ASSERT_EQ(1u, client->m_data.size());
EXPECT_EQ("response data", toString(client->m_data[0]));
- EXPECT_FALSE(client->m_responses[0].isMultipartPayload());
const char data2[] =
"Content-type: text/plain\n\n"
@@ -471,7 +474,6 @@ TEST(MultipartResponseTest, MultipartPayloadSet)
ASSERT_EQ(2u, client->m_responses.size());
ASSERT_EQ(2u, client->m_data.size());
EXPECT_EQ("response data2", toString(client->m_data[1]));
- EXPECT_TRUE(client->m_responses[1].isMultipartPayload());
}
} // namespace
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MultipartImageResourceParser.cpp ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698