| Index: content/renderer/dom_serializer_browsertest.cc
|
| diff --git a/content/renderer/dom_serializer_browsertest.cc b/content/renderer/dom_serializer_browsertest.cc
|
| index 5f531002d56f80ddccd0cc2a22a519b46710eca5..bfb779e553935fabebcad6b4323365c9584f6e6d 100644
|
| --- a/content/renderer/dom_serializer_browsertest.cc
|
| +++ b/content/renderer/dom_serializer_browsertest.cc
|
| @@ -260,23 +260,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,
|
| @@ -292,7 +288,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 =
|
| @@ -312,7 +308,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 =
|
| @@ -328,7 +324,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 =
|
| @@ -347,7 +343,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 =
|
| @@ -373,7 +369,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));
|
| @@ -429,7 +425,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));
|
| @@ -487,7 +483,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 =
|
| @@ -540,7 +536,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 =
|
| @@ -581,7 +577,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 =
|
| @@ -634,7 +630,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));
|
| @@ -704,7 +700,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 =
|
| @@ -740,11 +736,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);
|
| @@ -1003,24 +994,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(
|
|
|