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