| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 // Check the body's first node is text node and its contents are | 829 // Check the body's first node is text node and its contents are |
| 830 // "hello world" | 830 // "hello world" |
| 831 WebElement body_element = doc.body(); | 831 WebElement body_element = doc.body(); |
| 832 ASSERT_TRUE(!body_element.isNull()); | 832 ASSERT_TRUE(!body_element.isNull()); |
| 833 WebNode text_node = body_element.firstChild(); | 833 WebNode text_node = body_element.firstChild(); |
| 834 ASSERT_TRUE(text_node.isTextNode()); | 834 ASSERT_TRUE(text_node.isTextNode()); |
| 835 WebString text_node_contents = text_node.nodeValue(); | 835 WebString text_node_contents = text_node.nodeValue(); |
| 836 ASSERT_TRUE(std::string(text_node_contents.utf8()) == "hello world"); | 836 ASSERT_TRUE(std::string(text_node_contents.utf8()) == "hello world"); |
| 837 } | 837 } |
| 838 | 838 |
| 839 // Test that we don't crash when the page contains an iframe that |
| 840 // was handled as a download (http://crbug.com/42212). |
| 841 TEST_F(DomSerializerTests, SerializeDocumentWithDownloadedIFrame) { |
| 842 FilePath page_file_path = data_dir_; |
| 843 page_file_path = page_file_path.AppendASCII("dom_serializer"); |
| 844 page_file_path = page_file_path.AppendASCII("iframe-src-is-exe.htm"); |
| 845 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 846 ASSERT_TRUE(file_url.SchemeIsFile()); |
| 847 // Load the test file. |
| 848 LoadPageFromURL(file_url); |
| 849 // Do a recursive serialization. We pass if we don't crash. |
| 850 SerializeDomForURL(file_url, true); |
| 851 } |
| 852 |
| 839 } // namespace | 853 } // namespace |
| OLD | NEW |