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 d3b2e8b98290a748a90a9695287cc6f69efbafca..c078ce4548784c6d466d269af25c3c700bf00ca0 100644 |
--- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp |
@@ -30,6 +30,7 @@ |
#include "public/web/WebFrameSerializer.h" |
+#include "platform/testing/HistogramTester.h" |
#include "platform/testing/URLTestHelpers.h" |
#include "platform/testing/UnitTestHelpers.h" |
#include "platform/weborigin/KURL.h" |
@@ -234,6 +235,9 @@ class WebFrameSerializerSanitizationTest : public WebFrameSerializerTest { |
mhtml_delegate_.SetRemovePopupOverlay(remove_popup_overlay); |
} |
+ protected: |
+ HistogramTester histogram_tester_; |
+ |
private: |
SimpleMHTMLPartsGenerationDelegate mhtml_delegate_; |
}; |
@@ -359,6 +363,17 @@ TEST_F(WebFrameSerializerSanitizationTest, RemovePopupOverlayIfRequested) { |
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")); |
+ histogram_tester_.ExpectTotalCount( |
+ "PageSerialization.MhtmlGeneration.PopupOverlaySkippedCount", 1); |
+} |
+ |
+TEST_F(WebFrameSerializerSanitizationTest, PopupOverlayNotFound) { |
+ WebView()->Resize(WebSize(500, 500)); |
+ SetRemovePopupOverlay(true); |
+ String mhtml = |
+ GenerateMHTMLParts("http://www.test.com", "text_only_page.html"); |
+ histogram_tester_.ExpectTotalCount( |
+ "PageSerialization.MhtmlGeneration.PopupOverlaySkippedCount", 0); |
} |
TEST_F(WebFrameSerializerSanitizationTest, KeepPopupOverlayIfNotRequested) { |
@@ -367,6 +382,8 @@ TEST_F(WebFrameSerializerSanitizationTest, KeepPopupOverlayIfNotRequested) { |
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")); |
+ histogram_tester_.ExpectTotalCount( |
+ "PageSerialization.MhtmlGeneration.PopupOverlaySkippedCount", 0); |
} |
TEST_F(WebFrameSerializerSanitizationTest, RemoveElements) { |