| Index: third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
|
| diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
|
| index 23af6acacf4a5155960e845504c330af7c40fa2b..6b586cfee7b83e01aeb25cc0596a5796cff7f6be 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
|
| @@ -63,6 +63,13 @@ class SimpleWebFrameSerializerClient final : public WebFrameSerializerClient {
|
|
|
| class SimpleMHTMLPartsGenerationDelegate
|
| : public WebFrameSerializer::MHTMLPartsGenerationDelegate {
|
| + public:
|
| + SimpleMHTMLPartsGenerationDelegate() : m_removePopupOverlay(false) {}
|
| +
|
| + void setRemovePopupOverlay(bool removePopupOverlay) {
|
| + m_removePopupOverlay = removePopupOverlay;
|
| + }
|
| +
|
| private:
|
| bool shouldSkipResource(const WebURL&) final { return false; }
|
|
|
| @@ -73,6 +80,9 @@ class SimpleMHTMLPartsGenerationDelegate
|
| }
|
|
|
| bool useBinaryEncoding() final { return false; }
|
| + bool removePopupOverlay() final { return m_removePopupOverlay; }
|
| +
|
| + bool m_removePopupOverlay;
|
| };
|
|
|
| // Returns the count of match for substring |pattern| in string |str|.
|
| @@ -212,6 +222,10 @@ class WebFrameSerializerSanitizationTest : public WebFrameSerializerTest {
|
| return String(result.data(), result.size());
|
| }
|
|
|
| + void setRemovePopupOverlay(bool removePopupOverlay) {
|
| + m_mhtmlDelegate.setRemovePopupOverlay(removePopupOverlay);
|
| + }
|
| +
|
| private:
|
| SimpleMHTMLPartsGenerationDelegate m_mhtmlDelegate;
|
| };
|
| @@ -331,4 +345,20 @@ TEST_F(WebFrameSerializerSanitizationTest, ImageLoadedFromSrcForNormalDPI) {
|
| EXPECT_NE(WTF::kNotFound, mhtml.find("id=3D\"i2\" width=3D\"8\">"));
|
| }
|
|
|
| +TEST_F(WebFrameSerializerSanitizationTest, RemovePopupOverlayIfRequested) {
|
| + webView()->resize(WebSize(500, 500));
|
| + setRemovePopupOverlay(true);
|
| + String mhtml = generateMHTMLParts("http://www.test.com", "popup.html");
|
| + EXPECT_EQ(WTF::kNotFound, mhtml.find("class=3D\"overlay"));
|
| + EXPECT_EQ(WTF::kNotFound, mhtml.find("class=3D\"modal"));
|
| +}
|
| +
|
| +TEST_F(WebFrameSerializerSanitizationTest, KeepPopupOverlayIfNotRequested) {
|
| + webView()->resize(WebSize(500, 500));
|
| + setRemovePopupOverlay(false);
|
| + String mhtml = generateMHTMLParts("http://www.test.com", "popup.html");
|
| + EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"overlay"));
|
| + EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"modal"));
|
| +}
|
| +
|
| } // namespace blink
|
|
|