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

Unified Diff: third_party/WebKit/Source/web/tests/MHTMLTest.cpp

Issue 2841483007: MHTMLTest::TestMHTMLEncoding checks generated MTHML is well formed. (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/MHTMLTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
index 494f0713505ffc3e915dcbb684d4756014b7332f..c1790132c7378e375b8d4e80719ee5767c23d595 100644
--- a/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
+++ b/third_party/WebKit/Source/web/tests/MHTMLTest.cpp
@@ -35,6 +35,7 @@
#include "platform/SerializedResource.h"
#include "platform/SharedBuffer.h"
#include "platform/mhtml/MHTMLArchive.h"
+#include "platform/mhtml/MHTMLParser.h"
#include "platform/testing/URLTestHelpers.h"
#include "platform/testing/UnitTestHelpers.h"
#include "platform/weborigin/KURL.h"
@@ -207,6 +208,10 @@ TEST_F(MHTMLTest, TestMHTMLEncoding) {
RefPtr<RawData> data = Serialize("Test Serialization", "text/html",
MHTMLArchive::kUseDefaultEncoding);
+ // Validate the generated MHTML.
+ MHTMLParser parser(SharedBuffer::Create(data->data(), data->length()));
+ ASSERT_FALSE(parser.ParseArchive().IsEmpty()) << "Invalid MHTML";
Łukasz Anforowicz 2017/04/25 19:01:24 Would it be possible to increase the coverage of t
carlosk 2017/04/25 19:49:30 Done.
+
// Read the MHTML data line per line and do some pseudo-parsing to make sure
// the right encoding is used for the different sections.
LineReader line_reader(std::string(data->data(), data->length()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698