| 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->initializeMainFrame(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 23 matching lines...) Expand all Loading... |
| 210 setBaseFolder("pageserializer/dtd/"); | 214 setBaseFolder("pageserializer/dtd/"); |
| 211 | 215 |
| 212 registerURL("dtd.html", "text/html"); | 216 registerURL("dtd.html", "text/html"); |
| 213 serialize("dtd.html"); | 217 serialize("dtd.html"); |
| 214 | 218 |
| 215 String expectedStart("<!DOCTYPE html>"); | 219 String expectedStart("<!DOCTYPE html>"); |
| 216 EXPECT_TRUE(getSerializedData("dtd.html").startsWith(expectedStart)); | 220 EXPECT_TRUE(getSerializedData("dtd.html").startsWith(expectedStart)); |
| 217 } | 221 } |
| 218 | 222 |
| 219 } | 223 } |
| OLD | NEW |