Index: Source/web/tests/WebPageNewSerializerTest.cpp |
diff --git a/Source/web/tests/WebPageNewSerializerTest.cpp b/Source/web/tests/WebPageNewSerializerTest.cpp |
index fc8f3b43ed2f18dbac6a283cd50dd6135664ffc5..e42c8150a32d94f7df093734680cb2ffd2f56263 100644 |
--- a/Source/web/tests/WebPageNewSerializerTest.cpp |
+++ b/Source/web/tests/WebPageNewSerializerTest.cpp |
@@ -367,6 +367,30 @@ TEST_F(WebPageNewSerializeTest, SVGImageDontCrash) |
EXPECT_GT(mhtml.length(), 50U); |
} |
+ |
+TEST_F(WebPageNewSerializeTest, DontIncludeErrorImage) |
+{ |
+ WebURL pageUrl = toKURL("http://www.test.com"); |
+ WebURL imageUrl = toKURL("http://www.test.com/error_image.png"); |
+ |
+ registerMockedURLLoad(pageUrl, WebString::fromUTF8("page_with_img_error.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); |
+ registerMockedURLLoad(imageUrl, WebString::fromUTF8("error_image.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); |
+ |
+ loadURLInTopFrame(pageUrl); |
+ |
+ WebCString mhtmlData = WebPageSerializer::serializeToMHTML(webView()); |
+ ASSERT_FALSE(mhtmlData.isEmpty()); |
+ |
+ // Sniff the MHTML data to make sure image content is excluded. |
+ LineReader lineReader(std::string(mhtmlData.data())); |
+ std::string line; |
+ while (lineReader.getNextLine(&line)) { |
+ if (line.find("image/") != std::string::npos) |
+ FAIL() << "Error Image was not excluded " << line; |
+ } |
+} |
+ |
+ |
TEST_F(WebPageNewSerializeTest, NamespaceElementsDontCrash) |
{ |
WebURL pageUrl = toKURL("http://www.test.com"); |