Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp

Issue 2896563002: Update WebLocalFrameImpl with WebLocalFrameBase to break dependencies. (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2017 Google Inc. All rights reserved. 2 * Copyright (C) 2017 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
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/testing/URLTestHelpers.h" 35 #include "platform/testing/URLTestHelpers.h"
35 #include "platform/testing/UnitTestHelpers.h" 36 #include "platform/testing/UnitTestHelpers.h"
36 #include "platform/weborigin/KURL.h" 37 #include "platform/weborigin/KURL.h"
37 #include "platform/wtf/text/StringBuilder.h" 38 #include "platform/wtf/text/StringBuilder.h"
38 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
39 #include "public/platform/WebCString.h" 40 #include "public/platform/WebCString.h"
40 #include "public/platform/WebString.h" 41 #include "public/platform/WebString.h"
41 #include "public/platform/WebURL.h" 42 #include "public/platform/WebURL.h"
42 #include "public/platform/WebURLLoaderMockFactory.h" 43 #include "public/platform/WebURLLoaderMockFactory.h"
43 #include "public/web/WebFrameSerializerClient.h" 44 #include "public/web/WebFrameSerializerClient.h"
44 #include "testing/gtest/include/gtest/gtest.h" 45 #include "testing/gtest/include/gtest/gtest.h"
45 #include "web/WebLocalFrameImpl.h"
46 #include "web/tests/FrameTestHelpers.h" 46 #include "web/tests/FrameTestHelpers.h"
47 47
48 namespace blink { 48 namespace blink {
49 49
50 namespace { 50 namespace {
51 51
52 class SimpleWebFrameSerializerClient final : public WebFrameSerializerClient { 52 class SimpleWebFrameSerializerClient final : public WebFrameSerializerClient {
53 public: 53 public:
54 String ToString() { return builder_.ToString(); } 54 String ToString() { return builder_.ToString(); }
55 55
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 String file_path("frameserialization/" + file_name); 117 String file_path("frameserialization/" + file_name);
118 RegisterMockedFileURLLoad(parsed_url, file_path, "text/html"); 118 RegisterMockedFileURLLoad(parsed_url, file_path, "text/html");
119 FrameTestHelpers::LoadFrame(MainFrameImpl(), url.Utf8().data()); 119 FrameTestHelpers::LoadFrame(MainFrameImpl(), url.Utf8().data());
120 SingleLinkRewritingDelegate delegate(parsed_url, WebString("local")); 120 SingleLinkRewritingDelegate delegate(parsed_url, WebString("local"));
121 SimpleWebFrameSerializerClient serializer_client; 121 SimpleWebFrameSerializerClient serializer_client;
122 WebFrameSerializer::Serialize(MainFrameImpl(), &serializer_client, 122 WebFrameSerializer::Serialize(MainFrameImpl(), &serializer_client,
123 &delegate); 123 &delegate);
124 return serializer_client.ToString(); 124 return serializer_client.ToString();
125 } 125 }
126 126
127 WebLocalFrameImpl* MainFrameImpl() { 127 WebLocalFrameBase* MainFrameImpl() {
128 return helper_.WebView()->MainFrameImpl(); 128 return helper_.WebView()->MainFrameImpl();
129 } 129 }
130 130
131 private: 131 private:
132 FrameTestHelpers::WebViewHelper helper_; 132 FrameTestHelpers::WebViewHelper helper_;
133 }; 133 };
134 134
135 TEST_F(WebFrameSerializerTest, URLAttributeValues) { 135 TEST_F(WebFrameSerializerTest, URLAttributeValues) {
136 RegisterMockedImageURLLoad("javascript:\""); 136 RegisterMockedImageURLLoad("javascript:\"");
137 137
(...skipping 29 matching lines...) Expand all
167 } 167 }
168 168
169 TEST_F(WebFrameSerializerTest, FromUrlWithMinusMinus) { 169 TEST_F(WebFrameSerializerTest, FromUrlWithMinusMinus) {
170 String actual_html = 170 String actual_html =
171 SerializeFile("http://www.test.com?--x--", "text_only_page.html"); 171 SerializeFile("http://www.test.com?--x--", "text_only_page.html");
172 EXPECT_EQ("<!-- saved from url=(0030)http://www.test.com/?-%2Dx-%2D -->", 172 EXPECT_EQ("<!-- saved from url=(0030)http://www.test.com/?-%2Dx-%2D -->",
173 actual_html.Substring(1, 60)); 173 actual_html.Substring(1, 60));
174 } 174 }
175 175
176 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698