| 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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/renderer/render_view.h" | 14 #include "content/public/renderer/render_view.h" |
| 15 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
| 16 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
| 17 #include "content/public/test/content_browser_test_utils.h" | 17 #include "content/public/test/content_browser_test_utils.h" |
| 18 #include "content/public/test/routing_id_mangling_disabler.h" |
| 18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 19 #include "content/renderer/savable_resources.h" | 20 #include "content/renderer/savable_resources.h" |
| 20 #include "content/shell/browser/shell.h" | 21 #include "content/shell/browser/shell.h" |
| 21 #include "net/base/filename_util.h" | 22 #include "net/base/filename_util.h" |
| 22 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
| 23 #include "third_party/WebKit/public/platform/WebCString.h" | 24 #include "third_party/WebKit/public/platform/WebCString.h" |
| 24 #include "third_party/WebKit/public/platform/WebData.h" | 25 #include "third_party/WebKit/public/platform/WebData.h" |
| 25 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
| 26 #include "third_party/WebKit/public/platform/WebURL.h" | 27 #include "third_party/WebKit/public/platform/WebURL.h" |
| 27 #include "third_party/WebKit/public/platform/WebVector.h" | 28 #include "third_party/WebKit/public/platform/WebVector.h" |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 typedef base::hash_map<std::string, std::string> SerializedFrameContentMap; | 768 typedef base::hash_map<std::string, std::string> SerializedFrameContentMap; |
| 768 SerializedFrameContentMap serialized_frame_map_; | 769 SerializedFrameContentMap serialized_frame_map_; |
| 769 // Map frame_url to corresponding status of serialization finish. | 770 // Map frame_url to corresponding status of serialization finish. |
| 770 typedef base::hash_map<std::string, bool> SerializationFinishStatusMap; | 771 typedef base::hash_map<std::string, bool> SerializationFinishStatusMap; |
| 771 SerializationFinishStatusMap serialization_finish_status_; | 772 SerializationFinishStatusMap serialization_finish_status_; |
| 772 // Flag indicates whether the process of serializing DOM is finished or not. | 773 // Flag indicates whether the process of serializing DOM is finished or not. |
| 773 bool serialized_; | 774 bool serialized_; |
| 774 // The local_directory_name_ is dummy relative path of directory which | 775 // The local_directory_name_ is dummy relative path of directory which |
| 775 // contain all saved auxiliary files included all sub frames and resources. | 776 // contain all saved auxiliary files included all sub frames and resources. |
| 776 const base::FilePath local_directory_name_; | 777 const base::FilePath local_directory_name_; |
| 778 |
| 779 content::RoutingIDManglingDisabler mangling_disabler_; |
| 777 }; | 780 }; |
| 778 | 781 |
| 779 // If original contents have document type, the serialized contents also have | 782 // If original contents have document type, the serialized contents also have |
| 780 // document type. | 783 // document type. |
| 781 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithDocType) { | 784 IN_PROC_BROWSER_TEST_F(DomSerializerTests, SerializeHTMLDOMWithDocType) { |
| 782 base::FilePath page_file_path = | 785 base::FilePath page_file_path = |
| 783 GetTestFilePath("dom_serializer", "youtube_1.htm"); | 786 GetTestFilePath("dom_serializer", "youtube_1.htm"); |
| 784 GURL file_url = net::FilePathToFileURL(page_file_path); | 787 GURL file_url = net::FilePathToFileURL(page_file_path); |
| 785 ASSERT_TRUE(file_url.SchemeIsFile()); | 788 ASSERT_TRUE(file_url.SchemeIsFile()); |
| 786 // Load the test file. | 789 // Load the test file. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 NavigateToURL(shell(), file_url); | 1020 NavigateToURL(shell(), file_url); |
| 1018 | 1021 |
| 1019 PostTaskToInProcessRendererAndWait( | 1022 PostTaskToInProcessRendererAndWait( |
| 1020 base::Bind( | 1023 base::Bind( |
| 1021 &DomSerializerTests:: | 1024 &DomSerializerTests:: |
| 1022 SubResourceForElementsInNonHTMLNamespaceOnRenderer, | 1025 SubResourceForElementsInNonHTMLNamespaceOnRenderer, |
| 1023 base::Unretained(this), file_url)); | 1026 base::Unretained(this), file_url)); |
| 1024 } | 1027 } |
| 1025 | 1028 |
| 1026 } // namespace content | 1029 } // namespace content |
| OLD | NEW |