| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "public/web/WebFrameSerializer.h" | 31 #include "public/web/WebFrameSerializer.h" |
| 32 | 32 |
| 33 #include "core/exported/WebViewBase.h" | 33 #include "core/exported/WebViewBase.h" |
| 34 #include "core/frame/WebLocalFrameBase.h" |
| 34 #include "platform/mhtml/MHTMLArchive.h" | 35 #include "platform/mhtml/MHTMLArchive.h" |
| 35 #include "platform/mhtml/MHTMLParser.h" | 36 #include "platform/mhtml/MHTMLParser.h" |
| 36 #include "platform/testing/HistogramTester.h" | 37 #include "platform/testing/HistogramTester.h" |
| 37 #include "platform/testing/URLTestHelpers.h" | 38 #include "platform/testing/URLTestHelpers.h" |
| 38 #include "platform/testing/UnitTestHelpers.h" | 39 #include "platform/testing/UnitTestHelpers.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "platform/wtf/text/StringBuilder.h" | 41 #include "platform/wtf/text/StringBuilder.h" |
| 41 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebString.h" | 43 #include "public/platform/WebString.h" |
| 43 #include "public/platform/WebURL.h" | 44 #include "public/platform/WebURL.h" |
| 44 #include "public/platform/WebURLLoaderMockFactory.h" | 45 #include "public/platform/WebURLLoaderMockFactory.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 46 #include "web/WebLocalFrameImpl.h" | |
| 47 #include "web/tests/FrameTestHelpers.h" | 47 #include "web/tests/FrameTestHelpers.h" |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 class SimpleMHTMLPartsGenerationDelegate | 53 class SimpleMHTMLPartsGenerationDelegate |
| 54 : public WebFrameSerializer::MHTMLPartsGenerationDelegate { | 54 : public WebFrameSerializer::MHTMLPartsGenerationDelegate { |
| 55 public: | 55 public: |
| 56 SimpleMHTMLPartsGenerationDelegate() : remove_popup_overlay_(false) {} | 56 SimpleMHTMLPartsGenerationDelegate() : remove_popup_overlay_(false) {} |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 void RegisterMockedFileURLLoad(const KURL& url, | 156 void RegisterMockedFileURLLoad(const KURL& url, |
| 157 const String& file_path, | 157 const String& file_path, |
| 158 const String& mime_type = "image/png") { | 158 const String& mime_type = "image/png") { |
| 159 URLTestHelpers::RegisterMockedURLLoad( | 159 URLTestHelpers::RegisterMockedURLLoad( |
| 160 url, testing::WebTestDataPath(file_path.Utf8().data()), mime_type); | 160 url, testing::WebTestDataPath(file_path.Utf8().data()), mime_type); |
| 161 } | 161 } |
| 162 | 162 |
| 163 WebViewBase* WebView() { return helper_.WebView(); } | 163 WebViewBase* WebView() { return helper_.WebView(); } |
| 164 | 164 |
| 165 WebLocalFrameImpl* MainFrameImpl() { | 165 WebLocalFrameBase* MainFrameImpl() { |
| 166 return helper_.WebView()->MainFrameImpl(); | 166 return helper_.WebView()->MainFrameImpl(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 HistogramTester histogram_tester_; | 169 HistogramTester histogram_tester_; |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 FrameTestHelpers::WebViewHelper helper_; | 172 FrameTestHelpers::WebViewHelper helper_; |
| 173 SimpleMHTMLPartsGenerationDelegate mhtml_delegate_; | 173 SimpleMHTMLPartsGenerationDelegate mhtml_delegate_; |
| 174 }; | 174 }; |
| 175 | 175 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 mhtml.Find("<meta http-equiv=3D\"Content-Security-Policy")); | 340 mhtml.Find("<meta http-equiv=3D\"Content-Security-Policy")); |
| 341 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta name=3D\"description")); | 341 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta name=3D\"description")); |
| 342 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta http-equiv=3D\"refresh")); | 342 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta http-equiv=3D\"refresh")); |
| 343 | 343 |
| 344 // If an element is removed, its children should also be skipped. | 344 // If an element is removed, its children should also be skipped. |
| 345 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<select")); | 345 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<select")); |
| 346 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<option")); | 346 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<option")); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace blink | 349 } // namespace blink |
| OLD | NEW |