Index: third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp |
diff --git a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp |
index 3ab3b47b6c8698fb3c87ab0a97ff675e8fc9ff70..0c2821a8cfcdc0d54a4725388dc3fdaef386d99d 100644 |
--- a/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp |
@@ -40,6 +40,7 @@ |
#include "public/platform/WebUnitTestSupport.h" |
#include "public/web/WebDocument.h" |
#include "public/web/WebFrame.h" |
+#include "public/web/WebPageSerializerClient.h" |
#include "public/web/WebView.h" |
#include "web/tests/FrameTestHelpers.h" |
#include <gtest/gtest.h> |
@@ -49,6 +50,22 @@ using blink::URLTestHelpers::toKURL; |
namespace blink { |
+namespace { |
+class SimpleWebPageSerializerClient : public WebPageSerializerClient { |
+public: |
+ std::string toString() const { return m_string; } |
+ |
+private: |
+ void didSerializeDataForFrame(const WebURL&, const WebCString& data, PageSerializationStatus) final |
+ { |
+ m_string += data; |
+ } |
+ |
+ std::string m_string; |
+}; |
+ |
+} // namespace |
+ |
class WebPageSerializerTest : public testing::Test { |
public: |
WebPageSerializerTest() : m_supportedSchemes(static_cast<size_t>(3)) |
@@ -134,6 +151,20 @@ TEST_F(WebPageSerializerTest, HTMLNodes) |
EXPECT_TRUE(webVectorContains(resources, "file://c/my_folder/file.gif")); |
} |
+TEST_F(WebPageSerializerTest, fromUrlWithMinusMinus) |
+{ |
+ WebURL topFrameURL = toKURL("http://www.test.com?--x--"); |
+ registerMockedURLLoad(topFrameURL.spec(), WebString::fromUTF8("text_only_page.html")); |
+ loadURLInTopFrame(topFrameURL); |
+ |
+ SimpleWebPageSerializerClient serializerClient; |
+ WebVector<WebURL> links(&topFrameURL, 1); |
+ WebVector<WebString> localPaths(&"local", 1); |
+ WebPageSerializer::serialize(webView()->mainFrame()->toWebLocalFrame(), &serializerClient, links, localPaths, ""); |
+ |
+ EXPECT_EQ("<!-- saved from url=(0030)http://www.test.com/?-%2Dx-%2D -->", serializerClient.toString().substr(1, 60)); |
+} |
+ |
TEST_F(WebPageSerializerTest, MultipleFrames) |
{ |
// Register the mocked frames. |