OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 { | 75 { |
76 // Create and initialize the WebView. | 76 // Create and initialize the WebView. |
77 m_webViewImpl = toWebViewImpl(WebView::create(0)); | 77 m_webViewImpl = toWebViewImpl(WebView::create(0)); |
78 | 78 |
79 // We want the images to load and JavaScript to be on. | 79 // We want the images to load and JavaScript to be on. |
80 WebSettings* settings = m_webViewImpl->settings(); | 80 WebSettings* settings = m_webViewImpl->settings(); |
81 settings->setImagesEnabled(true); | 81 settings->setImagesEnabled(true); |
82 settings->setLoadsImagesAutomatically(true); | 82 settings->setLoadsImagesAutomatically(true); |
83 settings->setJavaScriptEnabled(true); | 83 settings->setJavaScriptEnabled(true); |
84 | 84 |
85 m_webViewImpl->initializeMainFrame(&m_webFrameClient); | 85 m_mainFrame = WebFrame::create(&m_webFrameClient); |
| 86 m_webViewImpl->setMainFrame(m_mainFrame); |
86 } | 87 } |
87 | 88 |
88 virtual void TearDown() | 89 virtual void TearDown() |
89 { | 90 { |
90 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 91 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); |
91 m_webViewImpl->close(); | 92 m_webViewImpl->close(); |
92 m_webViewImpl = 0; | 93 m_webViewImpl = 0; |
| 94 m_mainFrame->close(); |
| 95 m_mainFrame = 0; |
93 } | 96 } |
94 | 97 |
95 void setBaseUrl(const char* url) | 98 void setBaseUrl(const char* url) |
96 { | 99 { |
97 m_baseUrl = toKURL(url); | 100 m_baseUrl = toKURL(url); |
98 } | 101 } |
99 | 102 |
100 void setBaseFolder(const char* folder) | 103 void setBaseFolder(const char* folder) |
101 { | 104 { |
102 m_folder = WebString::fromUTF8(folder); | 105 m_folder = WebString::fromUTF8(folder); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 const SerializedResource* resource = getResource(url, mimeType); | 170 const SerializedResource* resource = getResource(url, mimeType); |
168 if (resource) | 171 if (resource) |
169 return String(resource->data->data()); | 172 return String(resource->data->data()); |
170 return String(); | 173 return String(); |
171 } | 174 } |
172 | 175 |
173 WebViewImpl* m_webViewImpl; | 176 WebViewImpl* m_webViewImpl; |
174 | 177 |
175 private: | 178 private: |
176 TestWebFrameClient m_webFrameClient; | 179 TestWebFrameClient m_webFrameClient; |
| 180 WebFrame* m_mainFrame; |
177 WebString m_folder; | 181 WebString m_folder; |
178 KURL m_baseUrl; | 182 KURL m_baseUrl; |
179 Vector<SerializedResource> m_resources; | 183 Vector<SerializedResource> m_resources; |
180 }; | 184 }; |
181 | 185 |
182 | 186 |
183 TEST_F(PageSerializerTest, InputImage) | 187 TEST_F(PageSerializerTest, InputImage) |
184 { | 188 { |
185 setBaseFolder("pageserializer/input-image/"); | 189 setBaseFolder("pageserializer/input-image/"); |
186 | 190 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 226 |
223 registerURL("font.html", "text/html"); | 227 registerURL("font.html", "text/html"); |
224 registerURL("font.ttf", "application/octet-stream"); | 228 registerURL("font.ttf", "application/octet-stream"); |
225 | 229 |
226 serialize("font.html"); | 230 serialize("font.html"); |
227 | 231 |
228 EXPECT_TRUE(isSerialized("font.ttf", "application/octet-stream")); | 232 EXPECT_TRUE(isSerialized("font.ttf", "application/octet-stream")); |
229 } | 233 } |
230 | 234 |
231 } | 235 } |
OLD | NEW |