| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 WebPageSerializer::generateMetaCharsetDeclaration(encoding).utf8(); | 577 WebPageSerializer::generateMetaCharsetDeclaration(encoding).utf8(); |
| 578 head_part += "</head>"; | 578 head_part += "</head>"; |
| 579 original_str.insert(pos, head_part); | 579 original_str.insert(pos, head_part); |
| 580 } | 580 } |
| 581 ASSERT_EQ(original_str, serialized_contents); | 581 ASSERT_EQ(original_str, serialized_contents); |
| 582 } | 582 } |
| 583 | 583 |
| 584 // Test situation of html entities in attribute value when serializing | 584 // Test situation of html entities in attribute value when serializing |
| 585 // HTML DOM. | 585 // HTML DOM. |
| 586 // This test started to fail at WebKit r65388. See http://crbug.com/52279. | 586 // This test started to fail at WebKit r65388. See http://crbug.com/52279. |
| 587 TEST_F(DomSerializerTests, DISABLED_SerializeHTMLDOMWithEntitiesInAttributeValue
) { | 587 TEST_F(DomSerializerTests, SerializeHTMLDOMWithEntitiesInAttributeValue) { |
| 588 FilePath page_file_path = data_dir_; | 588 FilePath page_file_path = data_dir_; |
| 589 page_file_path = page_file_path.AppendASCII( | 589 page_file_path = page_file_path.AppendASCII( |
| 590 "dom_serializer/htmlentities_in_attribute_value.htm"); | 590 "dom_serializer/htmlentities_in_attribute_value.htm"); |
| 591 // Get file URL. The URL is dummy URL to identify the following loading | 591 // Get file URL. The URL is dummy URL to identify the following loading |
| 592 // actions. The test content is in constant:original_contents. | 592 // actions. The test content is in constant:original_contents. |
| 593 GURL file_url = net::FilePathToFileURL(page_file_path); | 593 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 594 ASSERT_TRUE(file_url.SchemeIsFile()); | 594 ASSERT_TRUE(file_url.SchemeIsFile()); |
| 595 // Test contents. | 595 // Test contents. |
| 596 static const char* const original_contents = | 596 static const char* const original_contents = |
| 597 "<html><body title=\"&<>"'\"></body></html>"; | 597 "<html><body title=\"&<>"'\"></body></html>"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 627 head_part += | 627 head_part += |
| 628 WebPageSerializer::generateMetaCharsetDeclaration(encoding).utf8(); | 628 WebPageSerializer::generateMetaCharsetDeclaration(encoding).utf8(); |
| 629 head_part += "</head>"; | 629 head_part += "</head>"; |
| 630 original_str.insert(pos, head_part); | 630 original_str.insert(pos, head_part); |
| 631 } | 631 } |
| 632 ASSERT_EQ(original_str, serialized_contents); | 632 ASSERT_EQ(original_str, serialized_contents); |
| 633 } | 633 } |
| 634 | 634 |
| 635 // Test situation of non-standard HTML entities when serializing HTML DOM. | 635 // Test situation of non-standard HTML entities when serializing HTML DOM. |
| 636 // This test started to fail at WebKit r65351. See http://crbug.com/52279. | 636 // This test started to fail at WebKit r65351. See http://crbug.com/52279. |
| 637 TEST_F(DomSerializerTests, DISABLED_SerializeHTMLDOMWithNonStandardEntities) { | 637 TEST_F(DomSerializerTests, SerializeHTMLDOMWithNonStandardEntities) { |
| 638 // Make a test file URL and load it. | 638 // Make a test file URL and load it. |
| 639 FilePath page_file_path = data_dir_; | 639 FilePath page_file_path = data_dir_; |
| 640 page_file_path = page_file_path.AppendASCII("dom_serializer"); | 640 page_file_path = page_file_path.AppendASCII("dom_serializer"); |
| 641 page_file_path = page_file_path.AppendASCII("nonstandard_htmlentities.htm"); | 641 page_file_path = page_file_path.AppendASCII("nonstandard_htmlentities.htm"); |
| 642 GURL file_url = net::FilePathToFileURL(page_file_path); | 642 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 643 LoadPageFromURL(file_url); | 643 LoadPageFromURL(file_url); |
| 644 | 644 |
| 645 // Get value of BODY's title attribute in DOM. | 645 // Get value of BODY's title attribute in DOM. |
| 646 WebFrame* web_frame = FindSubFrameByURL(test_shell_->webView(), file_url); | 646 WebFrame* web_frame = FindSubFrameByURL(test_shell_->webView(), file_url); |
| 647 WebDocument doc = web_frame->document(); | 647 WebDocument doc = web_frame->document(); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 page_file_path = page_file_path.AppendASCII("iframe-src-is-exe.htm"); | 844 page_file_path = page_file_path.AppendASCII("iframe-src-is-exe.htm"); |
| 845 GURL file_url = net::FilePathToFileURL(page_file_path); | 845 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 846 ASSERT_TRUE(file_url.SchemeIsFile()); | 846 ASSERT_TRUE(file_url.SchemeIsFile()); |
| 847 // Load the test file. | 847 // Load the test file. |
| 848 LoadPageFromURL(file_url); | 848 LoadPageFromURL(file_url); |
| 849 // Do a recursive serialization. We pass if we don't crash. | 849 // Do a recursive serialization. We pass if we don't crash. |
| 850 SerializeDomForURL(file_url, true); | 850 SerializeDomForURL(file_url, true); |
| 851 } | 851 } |
| 852 | 852 |
| 853 } // namespace | 853 } // namespace |
| OLD | NEW |