| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 // Get value of BODY's title attribute in DOM. | 575 // Get value of BODY's title attribute in DOM. |
| 576 WebFrame* web_frame = FindSubFrameByURL(GetWebView(), file_url); | 576 WebFrame* web_frame = FindSubFrameByURL(GetWebView(), file_url); |
| 577 WebDocument doc = web_frame->document(); | 577 WebDocument doc = web_frame->document(); |
| 578 ASSERT_TRUE(doc.isHTMLDocument()); | 578 ASSERT_TRUE(doc.isHTMLDocument()); |
| 579 WebElement body_element = doc.body(); | 579 WebElement body_element = doc.body(); |
| 580 // Unescaped string for "%⊅¹'". | 580 // Unescaped string for "%⊅¹'". |
| 581 static const wchar_t parsed_value[] = { | 581 static const wchar_t parsed_value[] = { |
| 582 '%', 0x2285, 0x00b9, '\'', 0 | 582 '%', 0x2285, 0x00b9, '\'', 0 |
| 583 }; | 583 }; |
| 584 WebString value = body_element.getAttribute("title"); | 584 WebString value = body_element.getAttribute("title"); |
| 585 WebString content = doc.contentAsTextForTesting(); |
| 585 ASSERT_TRUE(base::UTF16ToWide(value) == parsed_value); | 586 ASSERT_TRUE(base::UTF16ToWide(value) == parsed_value); |
| 586 ASSERT_TRUE(base::UTF16ToWide(body_element.innerText()) == parsed_value); | 587 ASSERT_TRUE(base::UTF16ToWide(content) == parsed_value); |
| 587 | 588 |
| 588 // Do serialization. | 589 // Do serialization. |
| 589 SerializeDomForURL(file_url, false); | 590 SerializeDomForURL(file_url, false); |
| 590 // Check the serialized string. | 591 // Check the serialized string. |
| 591 ASSERT_TRUE(HasSerializedFrame(file_url)); | 592 ASSERT_TRUE(HasSerializedFrame(file_url)); |
| 592 const std::string& serialized_contents = | 593 const std::string& serialized_contents = |
| 593 GetSerializedContentForFrame(file_url); | 594 GetSerializedContentForFrame(file_url); |
| 594 // Confirm that the serialized string has no non-standard HTML entities. | 595 // Confirm that the serialized string has no non-standard HTML entities. |
| 595 ASSERT_EQ(std::string::npos, serialized_contents.find("%")); | 596 ASSERT_EQ(std::string::npos, serialized_contents.find("%")); |
| 596 ASSERT_EQ(std::string::npos, serialized_contents.find("⊅")); | 597 ASSERT_EQ(std::string::npos, serialized_contents.find("⊅")); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 NavigateToURL(shell(), file_url); | 1018 NavigateToURL(shell(), file_url); |
| 1018 | 1019 |
| 1019 PostTaskToInProcessRendererAndWait( | 1020 PostTaskToInProcessRendererAndWait( |
| 1020 base::Bind( | 1021 base::Bind( |
| 1021 &DomSerializerTests:: | 1022 &DomSerializerTests:: |
| 1022 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1023 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
| 1023 base::Unretained(this), file_url)); | 1024 base::Unretained(this), file_url)); |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 } // namespace content | 1027 } // namespace content |
| OLD | NEW |