| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 802 |
| 803 PostTaskToInProcessRendererAndWait( | 803 PostTaskToInProcessRendererAndWait( |
| 804 base::Bind( | 804 base::Bind( |
| 805 &DomSerializerTests::SerializeHTMLDOMWithoutDocTypeOnRenderer, | 805 &DomSerializerTests::SerializeHTMLDOMWithoutDocTypeOnRenderer, |
| 806 base::Unretained(this), file_url)); | 806 base::Unretained(this), file_url)); |
| 807 } | 807 } |
| 808 | 808 |
| 809 // Serialize XML document which has all 5 built-in entities. After | 809 // Serialize XML document which has all 5 built-in entities. After |
| 810 // finishing serialization, the serialized contents should be same | 810 // finishing serialization, the serialized contents should be same |
| 811 // with original XML document. | 811 // with original XML document. |
| 812 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeXMLDocWithBuiltInEntities) { | 812 // |
| 813 // TODO(tiger@opera.com): Disabled in preparation of page serializer merge -- |
| 814 // XML headers are handled differently in the merged serializer. |
| 815 // Bug: http://crbug.com/328354 |
| 816 IN_PROC_BROWSER_TEST_F(DomSerializerTests, |
| 817 DISABLED_SerializeXMLDocWithBuiltInEntities) { |
| 813 base::FilePath page_file_path = | 818 base::FilePath page_file_path = |
| 814 GetTestFilePath("dom_serializer", "note.html"); | 819 GetTestFilePath("dom_serializer", "note.html"); |
| 815 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); | 820 base::FilePath xml_file_path = GetTestFilePath("dom_serializer", "note.xml"); |
| 816 // Read original contents for later comparison. | 821 // Read original contents for later comparison. |
| 817 std::string original_contents; | 822 std::string original_contents; |
| 818 ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); | 823 ASSERT_TRUE(base::ReadFileToString(xml_file_path, &original_contents)); |
| 819 // Get file URL. | 824 // Get file URL. |
| 820 GURL file_url = net::FilePathToFileURL(page_file_path); | 825 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 821 GURL xml_file_url = net::FilePathToFileURL(xml_file_path); | 826 GURL xml_file_url = net::FilePathToFileURL(xml_file_path); |
| 822 ASSERT_TRUE(file_url.SchemeIsFile()); | 827 ASSERT_TRUE(file_url.SchemeIsFile()); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 } | 910 } |
| 906 | 911 |
| 907 // Test situation of html entities in attribute value when serializing | 912 // Test situation of html entities in attribute value when serializing |
| 908 // HTML DOM. | 913 // HTML DOM. |
| 909 // This test started to fail at WebKit r65388. See http://crbug.com/52279. | 914 // This test started to fail at WebKit r65388. See http://crbug.com/52279. |
| 910 // | 915 // |
| 911 // TODO(tiger@opera.com): Disabled in preparation of page serializer merge -- | 916 // TODO(tiger@opera.com): Disabled in preparation of page serializer merge -- |
| 912 // Some attributes are handled differently in the merged serializer. | 917 // Some attributes are handled differently in the merged serializer. |
| 913 // Bug: http://crbug.com/328354 | 918 // Bug: http://crbug.com/328354 |
| 914 IN_PROC_BROWSER_TEST_F(DomSerializerTests, | 919 IN_PROC_BROWSER_TEST_F(DomSerializerTests, |
| 915 DISABLE_SerializeHTMLDOMWithEntitiesInAttributeValue) { | 920 DISABLED_SerializeHTMLDOMWithEntitiesInAttributeValue) { |
| 916 // Need to spin up the renderer and also navigate to a file url so that the | 921 // Need to spin up the renderer and also navigate to a file url so that the |
| 917 // renderer code doesn't attempt a fork when it sees a load to file scheme | 922 // renderer code doesn't attempt a fork when it sees a load to file scheme |
| 918 // from non-file scheme. | 923 // from non-file scheme. |
| 919 NavigateToURL(shell(), GetTestUrl(".", "simple_page.html")); | 924 NavigateToURL(shell(), GetTestUrl(".", "simple_page.html")); |
| 920 | 925 |
| 921 PostTaskToInProcessRendererAndWait( | 926 PostTaskToInProcessRendererAndWait( |
| 922 base::Bind( | 927 base::Bind( |
| 923 &DomSerializerTests:: | 928 &DomSerializerTests:: |
| 924 SerializeHTMLDOMWithEntitiesInAttributeValueOnRenderer, | 929 SerializeHTMLDOMWithEntitiesInAttributeValueOnRenderer, |
| 925 base::Unretained(this))); | 930 base::Unretained(this))); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 944 | 949 |
| 945 // Test situation of BASE tag in original document when serializing HTML DOM. | 950 // Test situation of BASE tag in original document when serializing HTML DOM. |
| 946 // When serializing, we should comment the BASE tag, append a new BASE tag. | 951 // When serializing, we should comment the BASE tag, append a new BASE tag. |
| 947 // rewrite all the savable URLs to relative local path, and change other URLs | 952 // rewrite all the savable URLs to relative local path, and change other URLs |
| 948 // to absolute URLs. | 953 // to absolute URLs. |
| 949 // | 954 // |
| 950 // TODO(tiger@opera.com): Disabled in preparation of page serializer merge -- | 955 // TODO(tiger@opera.com): Disabled in preparation of page serializer merge -- |
| 951 // Base tags are handled a bit different in merged version. | 956 // Base tags are handled a bit different in merged version. |
| 952 // Bug: http://crbug.com/328354 | 957 // Bug: http://crbug.com/328354 |
| 953 IN_PROC_BROWSER_TEST_F(DomSerializerTests, | 958 IN_PROC_BROWSER_TEST_F(DomSerializerTests, |
| 954 DISABLE_SerializeHTMLDOMWithBaseTag) { | 959 DISABLED_SerializeHTMLDOMWithBaseTag) { |
| 955 base::FilePath page_file_path = GetTestFilePath( | 960 base::FilePath page_file_path = GetTestFilePath( |
| 956 "dom_serializer", "html_doc_has_base_tag.htm"); | 961 "dom_serializer", "html_doc_has_base_tag.htm"); |
| 957 | 962 |
| 958 // Get page dir URL which is base URL of this file. | 963 // Get page dir URL which is base URL of this file. |
| 959 base::FilePath dir_name = page_file_path.DirName(); | 964 base::FilePath dir_name = page_file_path.DirName(); |
| 960 dir_name = dir_name.Append( | 965 dir_name = dir_name.Append( |
| 961 base::FilePath::StringType(base::FilePath::kSeparators[0], 1)); | 966 base::FilePath::StringType(base::FilePath::kSeparators[0], 1)); |
| 962 GURL path_dir_url = net::FilePathToFileURL(dir_name); | 967 GURL path_dir_url = net::FilePathToFileURL(dir_name); |
| 963 | 968 |
| 964 // Get file URL. | 969 // Get file URL. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 NavigateToURL(shell(), file_url); | 1016 NavigateToURL(shell(), file_url); |
| 1012 | 1017 |
| 1013 PostTaskToInProcessRendererAndWait( | 1018 PostTaskToInProcessRendererAndWait( |
| 1014 base::Bind( | 1019 base::Bind( |
| 1015 &DomSerializerTests:: | 1020 &DomSerializerTests:: |
| 1016 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1021 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
| 1017 base::Unretained(this), file_url)); | 1022 base::Unretained(this), file_url)); |
| 1018 } | 1023 } |
| 1019 | 1024 |
| 1020 } // namespace content | 1025 } // namespace content |
| OLD | NEW |