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

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

Issue 1808353003: Make multipart/x-mixed-replace parser more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@multipart-3
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/MultipartImageResourceParser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
index 236650a15ea211a2162aad68ab1ae2ab26156ccd..cd4c1595a93e7bb9aaea120749fa22b6bfece9f3 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp
@@ -123,11 +123,15 @@ TEST(ImageResourceTest, MultipartImage)
// The first bytes arrive. The data buffer is created, but no image is created.
cachedImage->appendData(secondPart, strlen(secondPart));
ASSERT_TRUE(cachedImage->resourceBuffer());
- ASSERT_EQ(cachedImage->resourceBuffer()->size(), strlen(secondPart));
ASSERT_FALSE(cachedImage->hasImage());
ASSERT_EQ(client.imageChangedCount(), 0);
ASSERT_FALSE(client.notifyFinishedCalled());
+ const char thirdPart[] = "--boundary";
+ cachedImage->appendData(thirdPart, strlen(thirdPart));
+ ASSERT_TRUE(cachedImage->resourceBuffer());
+ ASSERT_EQ(cachedImage->resourceBuffer()->size(), strlen(secondPart) - 1);
+
// This part finishes. The image is created, callbacks are sent, and the data buffer is cleared.
cachedImage->finish();
ASSERT_FALSE(cachedImage->resourceBuffer());
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/MultipartImageResourceParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698