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

Unified Diff: Source/web/tests/WebPageNewSerializerTest.cpp

Issue 1167413004: Merge page serializers [4/12] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix nits Created 5 years, 6 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 | « Source/web/tests/PageSerializerTest.cpp ('k') | Source/web/tests/data/pageserializer/blank_frames.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebPageNewSerializerTest.cpp
diff --git a/Source/web/tests/WebPageNewSerializerTest.cpp b/Source/web/tests/WebPageNewSerializerTest.cpp
index d0142f3e7e8b887f5a87c0fd7bf13949f66dc2b8..a7b5b154e2cbff623dc23d73ad9771389310d263 100644
--- a/Source/web/tests/WebPageNewSerializerTest.cpp
+++ b/Source/web/tests/WebPageNewSerializerTest.cpp
@@ -205,37 +205,6 @@ private:
WebString m_svgMimeType;
};
-// Tests that a page with resources and sub-frame is reported with all its resources.
-TEST_F(WebPageNewSerializeTest, PageWithFrames)
-{
- // Register the mocked frames.
- registerMockedURLLoad(toTestURL(""), WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-
- loadURLInTopFrame(toKURL(m_baseURL));
-
- WebVector<WebPageSerializer::Resource> resources;
- WebPageSerializer::serialize(webView(), &resources);
- ASSERT_FALSE(resources.isEmpty());
-
- // The first resource should be the main-frame.
- const WebPageSerializer::Resource& resource = resources[0];
- EXPECT_TRUE(resource.url == WebURL(toKURL(m_baseURL)));
- EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
- EXPECT_FALSE(resource.data.isEmpty());
-
- EXPECT_EQ(6U, resources.size()); // There should be no duplicates.
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "red_background.png", "image/png"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "green_background.png", "image/png"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "blue_background.png", "image/png"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "iframe.html", "text/html"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "iframe2.html", "text/html"));
-}
-
// Test that when serializing a page, all CSS resources are reported, including url()'s
// and imports and links. Note that we don't test the resources contents, we only make sure
// they are all reported with the right mime type and that they contain some data.
@@ -269,38 +238,6 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources)
EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "ol-dot.png", "image/png"));
}
-// Tests that when serializing a page with blank frames these are reported with their resources.
-TEST_F(WebPageNewSerializeTest, BlankFrames)
-{
- // Register the mocked frame and load it.
- WebURL topFrameURL = toKURL(m_baseURL);
- registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-
- loadURLInTopFrame(topFrameURL);
-
- WebVector<WebPageSerializer::Resource> resources;
- WebPageSerializer::serialize(webView(), &resources);
- ASSERT_FALSE(resources.isEmpty());
-
- // The first resource should be the main-frame.
- const WebPageSerializer::Resource& resource = resources[0];
- EXPECT_TRUE(resource.url == WebURL(toKURL(m_baseURL)));
- EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html")));
- EXPECT_FALSE(resource.data.isEmpty());
-
- EXPECT_EQ(7U, resources.size()); // There should be no duplicates.
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "red_background.png", "image/png"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "orange_background.png", "image/png"));
- EXPECT_TRUE(resourceVectorContains(resources, m_baseURL + "blue_background.png", "image/png"));
- // The blank frames should have got a magic URL.
- EXPECT_TRUE(resourceVectorContains(resources, "wyciwyg://frame/0", "text/html"));
- EXPECT_TRUE(resourceVectorContains(resources, "wyciwyg://frame/1", "text/html"));
- EXPECT_TRUE(resourceVectorContains(resources, "wyciwyg://frame/2", "text/html"));
-}
-
TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration)
{
WebURL topFrameURL = toTestURL("simple.xhtml");
@@ -363,35 +300,4 @@ TEST_F(WebPageNewSerializeTest, FAILS_TestMHTMLEncoding)
EXPECT_EQ(12, sectionCheckedCount);
}
-TEST_F(WebPageNewSerializeTest, SubFrameSerialization)
-{
- WebURL pageUrl = toKURL(m_baseURL);
- registerMockedURLLoad(pageUrl, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType());
- registerMockedURLLoad(toTestURL("red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
- registerMockedURLLoad(toTestURL("blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType());
-
- loadURLInTopFrame(pageUrl);
-
- WebVector<WebURL> localLinks(static_cast<size_t>(2));
- WebVector<WebString> localPaths(static_cast<size_t>(2));
- localLinks[0] = pageUrl;
- localPaths[0] = WebString("/");
- localLinks[1] = toTestURL("iframe.html");
- localPaths[1] = WebString("SavedFiles/iframe.html");
-
- WebString serializedData;
- FrameDataWebPageSerializerClient client(pageUrl, &serializedData);
-
- // We just want to make sure nothing crazy happens, namely that no
- // assertions are hit. As a sanity check, we also make sure that some data
- // was returned.
- WebPageSerializer::serialize(webView()->mainFrame()->toWebLocalFrame(), true, &client, localLinks, localPaths, WebString(""));
-
- // Subframe src
- EXPECT_TRUE(static_cast<String>(serializedData).contains("src=\"SavedFiles/iframe.html\""));
-}
-
}
« no previous file with comments | « Source/web/tests/PageSerializerTest.cpp ('k') | Source/web/tests/data/pageserializer/blank_frames.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698