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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 // Serialize XML document which has all 5 built-in entities. After | 814 // Serialize XML document which has all 5 built-in entities. After |
815 // finishing serialization, the serialized contents should be same | 815 // finishing serialization, the serialized contents should be same |
816 // with original XML document. | 816 // with original XML document. |
817 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) { | 817 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) { |
818 base::FilePath page_file_path = | 818 base::FilePath page_file_path = |
819 GetTestFilePath("dom_serializer", "note.html"); | 819 GetTestFilePath("dom_serializer", "note.html"); |
820 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); | 820 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); |
821 // Read original contents for later comparison. | 821 // Read original contents for later comparison. |
822 std::string original_contents; | 822 std::string original_contents; |
823 ASSERT_TRUE(file_util::ReadFileToString(xml_file_path, &original_contents)); | 823 ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); |
824 // Get file URL. | 824 // Get file URL. |
825 GURL file_url = net::FilePathToFileURL(page_file_path); | 825 GURL file_url = net::FilePathToFileURL(page_file_path); |
826 GURL xml_file_url = net::FilePathToFileURL(xml_file_path); | 826 GURL xml_file_url = net::FilePathToFileURL(xml_file_path); |
827 ASSERT_TRUE(file_url.SchemeIsFile()); | 827 ASSERT_TRUE(file_url.SchemeIsFile()); |
828 // Load the test file. | 828 // Load the test file. |
829 NavigateToURL(shell(), file_url); | 829 NavigateToURL(shell(), file_url); |
830 | 830 |
831 PostTaskToInProcessRendererAndWait( | 831 PostTaskToInProcessRendererAndWait( |
832 base::Bind( | 832 base::Bind( |
833 &DomSerializerTests::SerializeXMLDocWithBuiltInEntitiesOnRenderer, | 833 &DomSerializerTests::SerializeXMLDocWithBuiltInEntitiesOnRenderer, |
834 base::Unretained(this), xml_file_url, original_contents)); | 834 base::Unretained(this), xml_file_url, original_contents)); |
835 } | 835 } |
836 | 836 |
837 // When serializing DOM, we add MOTW declaration before html tag. | 837 // When serializing DOM, we add MOTW declaration before html tag. |
838 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) { | 838 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithAddingMOTW) { |
839 base::FilePath page_file_path = | 839 base::FilePath page_file_path = |
840 GetTestFilePath("dom_serializer", "youtube_2.htm"); | 840 GetTestFilePath("dom_serializer", "youtube_2.htm"); |
841 // Read original contents for later comparison . | 841 // Read original contents for later comparison . |
842 std::string original_contents; | 842 std::string original_contents; |
843 ASSERT_TRUE(file_util::ReadFileToString(page_file_path, &original_contents)); | 843 ASSERT_TRUE(base::ReadFileToString(page_file_path, &original_contents)); |
844 // Get file URL. | 844 // Get file URL. |
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 | 847 |
848 // Load the test file. | 848 // Load the test file. |
849 NavigateToURL(shell(), file_url); | 849 NavigateToURL(shell(), file_url); |
850 | 850 |
851 PostTaskToInProcessRendererAndWait( | 851 PostTaskToInProcessRendererAndWait( |
852 base::Bind( | 852 base::Bind( |
853 &DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer, | 853 &DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 NavigateToURL(shell(), file_url); | 1007 NavigateToURL(shell(), file_url); |
1008 | 1008 |
1009 PostTaskToInProcessRendererAndWait( | 1009 PostTaskToInProcessRendererAndWait( |
1010 base::Bind( | 1010 base::Bind( |
1011 &DomSerializerTests:: | 1011 &DomSerializerTests:: |
1012 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1012 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
1013 base::Unretained(this), file_url)); | 1013 base::Unretained(this), file_url)); |
1014 } | 1014 } |
1015 | 1015 |
1016 } // namespace content | 1016 } // namespace content |
OLD | NEW |