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

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

Issue 2841223002: Add UMA for popup overlays removed from saved MHTML page (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
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) {

Powered by Google App Engine
This is Rietveld 408576698