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

Unified Diff: content/renderer/dom_serializer_browsertest.cc

Issue 1371533002: Remove "recursive" parameter from WebPageSerializer::serialize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-complete-serialization
Patch Set: Rebasing... Created 5 years, 3 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 | « chrome/test/data/downloads/iframe-src-is-a-download.htm ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/dom_serializer_browsertest.cc
diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc
index 09890099b33412f15a27ead56450d954ebd783a4..781fee0f3ce189ae07de2e3ae5c7b3e06a28a538 100644
--- a/content/renderer/dom_serializer_browsertest.cc
+++ b/content/renderer/dom_serializer_browsertest.cc
@@ -259,23 +259,19 @@ class DomSerializerTests : public ContentBrowserTest,
runner->Run();
}
- // Serialize page DOM according to specific page URL. The parameter
- // recursive_serialization indicates whether we will serialize all
- // sub-frames.
- void SerializeDomForURL(const GURL& page_url,
- bool recursive_serialization) {
- // Find corresponding WebFrame according to page_url.
- WebFrame* web_frame = FindSubFrameByURL(GetWebView(), page_url);
+ // Serialize DOM belonging to a frame with the specified |frame_url|.
+ void SerializeDomForURL(const GURL& frame_url) {
+ // Find corresponding WebFrame according to frame_url.
+ WebFrame* web_frame = FindSubFrameByURL(GetWebView(), frame_url);
ASSERT_TRUE(web_frame != NULL);
WebVector<WebURL> links;
- links.assign(&page_url, 1);
+ links.assign(&frame_url, 1);
WebString file_path =
base::FilePath(FILE_PATH_LITERAL("c:\\dummy.htm")).AsUTF16Unsafe();
WebVector<WebString> local_paths;
local_paths.assign(&file_path, 1);
// Start serializing DOM.
bool result = WebPageSerializer::serialize(web_frame->toWebLocalFrame(),
- recursive_serialization,
static_cast<WebPageSerializerClient*>(this),
links,
local_paths,
@@ -291,7 +287,7 @@ class DomSerializerTests : public ContentBrowserTest,
WebDocument doc = web_frame->document();
ASSERT_TRUE(HasDocType(doc));
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Load the serialized contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -311,7 +307,7 @@ class DomSerializerTests : public ContentBrowserTest,
WebDocument doc = web_frame->document();
ASSERT_TRUE(!HasDocType(doc));
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Load the serialized contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -327,7 +323,7 @@ class DomSerializerTests : public ContentBrowserTest,
void SerializeXMLDocWithBuiltInEntitiesOnRenderer(
const GURL& xml_file_url, const std::string& original_contents) {
// Do serialization.
- SerializeDomForURL(xml_file_url, false);
+ SerializeDomForURL(xml_file_url);
// Compare the serialized contents with original contents.
ASSERT_TRUE(HasSerializedFrame(xml_file_url));
const std::string& serialized_contents =
@@ -346,7 +342,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(std::string::npos == original_contents.find(motw_declaration));
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Make sure the serialized contents have MOTW ;
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -372,7 +368,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(charset_info.empty());
}
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Load the serialized contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
@@ -428,7 +424,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(charset_declaration_count > 1);
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Load the serialized contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
@@ -486,7 +482,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(text_node.isTextNode());
ASSERT_TRUE(std::string(text_node.nodeValue().utf8()) == "&<>\"\'");
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Compare the serialized contents with original contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -539,7 +535,7 @@ class DomSerializerTests : public ContentBrowserTest,
WebString value = body_ele.getAttribute("title");
ASSERT_TRUE(std::string(value.utf8()) == "&<>\"\'");
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Compare the serialized contents with original contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -580,7 +576,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(base::UTF16ToWide(content) == parsed_value);
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Check the serialized string.
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -633,7 +629,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_NE(original_base_url, path_dir_url);
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Load the serialized contents.
ASSERT_TRUE(HasSerializedFrame(file_url));
@@ -703,7 +699,7 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(head_element.childNodes().length() == 0);
// Do serialization.
- SerializeDomForURL(file_url, false);
+ SerializeDomForURL(file_url);
// Make sure the serialized contents have META ;
ASSERT_TRUE(HasSerializedFrame(file_url));
const std::string& serialized_contents =
@@ -739,11 +735,6 @@ class DomSerializerTests : public ContentBrowserTest,
ASSERT_TRUE(std::string(text_node_contents.utf8()) == "hello world");
}
- void SerializeDocumentWithDownloadedIFrameOnRenderer(const GURL& file_url) {
- // Do a recursive serialization. We pass if we don't crash.
- SerializeDomForURL(file_url, true);
- }
-
void SubResourceForElementsInNonHTMLNamespaceOnRenderer(
const GURL& file_url) {
WebFrame* web_frame = FindSubFrameByURL(GetWebView(), file_url);
@@ -1002,24 +993,6 @@ IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithEmptyHead) {
base::Unretained(this)));
}
-// Test that we don't crash when the page contains an iframe that
-// was handled as a download (http://crbug.com/42212).
-IN_PROC_BROWSER_TEST_F(DomSerializerTests,
- SerializeDocumentWithDownloadedIFrame) {
- base::FilePath page_file_path = GetTestFilePath(
- "dom_serializer", "iframe-src-is-exe.htm");
- GURL file_url = net::FilePathToFileURL(page_file_path);
- ASSERT_TRUE(file_url.SchemeIsFile());
- // Load the test file.
- NavigateToURL(shell(), file_url);
-
- PostTaskToInProcessRendererAndWait(
- base::Bind(
- &DomSerializerTests::
- SerializeDocumentWithDownloadedIFrameOnRenderer,
- base::Unretained(this), file_url));
-}
-
IN_PROC_BROWSER_TEST_F(DomSerializerTests,
SubResourceForElementsInNonHTMLNamespace) {
base::FilePath page_file_path = GetTestFilePath(
« no previous file with comments | « chrome/test/data/downloads/iframe-src-is-a-download.htm ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698