| 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_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 } | 671 } |
| 672 | 672 |
| 673 // Test situation of BASE tag in original document when serializing HTML DOM. | 673 // Test situation of BASE tag in original document when serializing HTML DOM. |
| 674 // When serializing, we should comment the BASE tag, append a new BASE tag. | 674 // When serializing, we should comment the BASE tag, append a new BASE tag. |
| 675 // rewrite all the savable URLs to relative local path, and change other URLs | 675 // rewrite all the savable URLs to relative local path, and change other URLs |
| 676 // to absolute URLs. | 676 // to absolute URLs. |
| 677 TEST_F(DomSerializerTests, SerializeHTMLDOMWithBaseTag) { | 677 TEST_F(DomSerializerTests, SerializeHTMLDOMWithBaseTag) { |
| 678 // There are total 2 available base tags in this test file. | 678 // There are total 2 available base tags in this test file. |
| 679 const int kTotalBaseTagCountInTestFile = 2; | 679 const int kTotalBaseTagCountInTestFile = 2; |
| 680 | 680 |
| 681 base::FilePath page_file_path = data_dir_.AppendASCII("dom_serializer"); | 681 base::FilePath page_file_path = |
| 682 file_util::EnsureEndsWithSeparator(&page_file_path); | 682 data_dir_.AppendASCII("dom_serializer").AsEndingWithSeparator(); |
| 683 | 683 |
| 684 // Get page dir URL which is base URL of this file. | 684 // Get page dir URL which is base URL of this file. |
| 685 GURL path_dir_url = net::FilePathToFileURL(page_file_path); | 685 GURL path_dir_url = net::FilePathToFileURL(page_file_path); |
| 686 // Get file path. | 686 // Get file path. |
| 687 page_file_path = | 687 page_file_path = |
| 688 page_file_path.AppendASCII("html_doc_has_base_tag.htm"); | 688 page_file_path.AppendASCII("html_doc_has_base_tag.htm"); |
| 689 // Get file URL. | 689 // Get file URL. |
| 690 GURL file_url = net::FilePathToFileURL(page_file_path); | 690 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 691 ASSERT_TRUE(file_url.SchemeIsFile()); | 691 ASSERT_TRUE(file_url.SchemeIsFile()); |
| 692 // Load the test file. | 692 // Load the test file. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 ASSERT_TRUE(web_frame != NULL); | 863 ASSERT_TRUE(web_frame != NULL); |
| 864 WebDocument doc = web_frame->document(); | 864 WebDocument doc = web_frame->document(); |
| 865 WebNode lastNodeInBody = doc.body().lastChild(); | 865 WebNode lastNodeInBody = doc.body().lastChild(); |
| 866 ASSERT_EQ(WebNode::ElementNode, lastNodeInBody.nodeType()); | 866 ASSERT_EQ(WebNode::ElementNode, lastNodeInBody.nodeType()); |
| 867 WebString uri = webkit_glue::GetSubResourceLinkFromElement( | 867 WebString uri = webkit_glue::GetSubResourceLinkFromElement( |
| 868 lastNodeInBody.to<WebElement>()); | 868 lastNodeInBody.to<WebElement>()); |
| 869 EXPECT_TRUE(uri.isNull()); | 869 EXPECT_TRUE(uri.isNull()); |
| 870 } | 870 } |
| 871 | 871 |
| 872 } // namespace | 872 } // namespace |
| OLD | NEW |