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

Side by Side Diff: webkit/glue/dom_serializer_unittest.cc

Issue 3205010: Replaced supl (sup-El) by sup1 (sup-One) in DOMSerializer test because there ... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/data/dom_serializer/nonstandard_htmlentities.htm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
648 ASSERT_TRUE(doc.isHTMLDocument()); 648 ASSERT_TRUE(doc.isHTMLDocument());
649 WebElement body_element = doc.body(); 649 WebElement body_element = doc.body();
650 // Unescaped string for "%⊅&supl;'". 650 // Unescaped string for "%⊅¹'".
651 static const wchar_t parsed_value[] = { 651 static const wchar_t parsed_value[] = {
652 '%', 0x2285, 0x00b9, '\'', 0 652 '%', 0x2285, 0x00b9, '\'', 0
653 }; 653 };
654 WebString value = body_element.getAttribute("title"); 654 WebString value = body_element.getAttribute("title");
655 ASSERT_TRUE(UTF16ToWide(value) == parsed_value); 655 ASSERT_TRUE(UTF16ToWide(value) == parsed_value);
656 ASSERT_TRUE(UTF16ToWide(body_element.innerText()) == parsed_value); 656 ASSERT_TRUE(UTF16ToWide(body_element.innerText()) == parsed_value);
657 657
658 // Do serialization. 658 // Do serialization.
659 SerializeDomForURL(file_url, false); 659 SerializeDomForURL(file_url, false);
660 // Check the serialized string. 660 // Check the serialized string.
661 ASSERT_TRUE(HasSerializedFrame(file_url)); 661 ASSERT_TRUE(HasSerializedFrame(file_url));
662 const std::string& serialized_contents = 662 const std::string& serialized_contents =
663 GetSerializedContentForFrame(file_url); 663 GetSerializedContentForFrame(file_url);
664 // Confirm that the serialized string has no non-standard HTML entities. 664 // Confirm that the serialized string has no non-standard HTML entities.
665 ASSERT_EQ(std::string::npos, serialized_contents.find("%")); 665 ASSERT_EQ(std::string::npos, serialized_contents.find("%"));
666 ASSERT_EQ(std::string::npos, serialized_contents.find("⊅")); 666 ASSERT_EQ(std::string::npos, serialized_contents.find("⊅"));
667 ASSERT_EQ(std::string::npos, serialized_contents.find("&supl;")); 667 ASSERT_EQ(std::string::npos, serialized_contents.find("¹"));
668 ASSERT_EQ(std::string::npos, serialized_contents.find("'")); 668 ASSERT_EQ(std::string::npos, serialized_contents.find("'"));
669 } 669 }
670 670
671 // Test situation of BASE tag in original document when serializing HTML DOM. 671 // Test situation of BASE tag in original document when serializing HTML DOM.
672 // When serializing, we should comment the BASE tag, append a new BASE tag. 672 // When serializing, we should comment the BASE tag, append a new BASE tag.
673 // rewrite all the savable URLs to relative local path, and change other URLs 673 // rewrite all the savable URLs to relative local path, and change other URLs
674 // to absolute URLs. 674 // to absolute URLs.
675 TEST_F(DomSerializerTests, SerializeHTMLDOMWithBaseTag) { 675 TEST_F(DomSerializerTests, SerializeHTMLDOMWithBaseTag) {
676 // There are total 2 available base tags in this test file. 676 // There are total 2 available base tags in this test file.
677 const int kTotalBaseTagCountInTestFile = 2; 677 const int kTotalBaseTagCountInTestFile = 2;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « webkit/data/dom_serializer/nonstandard_htmlentities.htm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698