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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::
fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType())
; | 195 registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::
fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType())
; |
196 registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString:
:fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType(
)); | 196 registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString:
:fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType(
)); |
197 registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebS
tring::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), p
ngMimeType()); | 197 registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebS
tring::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), p
ngMimeType()); |
198 registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), We
bString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"
), pngMimeType()); | 198 registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), We
bString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"
), pngMimeType()); |
199 registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), Web
String::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"),
pngMimeType()); | 199 registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), Web
String::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"),
pngMimeType()); |
200 | 200 |
201 loadURLInTopFrame(topFrameURL); | 201 loadURLInTopFrame(topFrameURL); |
202 // OBJECT/EMBED have some delay to start to load their content. The first | 202 // OBJECT/EMBED have some delay to start to load their content. The first |
203 // serveAsynchronousMockedRequests call in loadURLInTopFrame() finishes | 203 // serveAsynchronousMockedRequests call in loadURLInTopFrame() finishes |
204 // before the start. | 204 // before the start. |
205 RefPtr<Document> document = static_cast<PassRefPtr<Document> >(webView()->ma
inFrame()->document()); | 205 RefPtrWillBeRawPtr<Document> document = static_cast<PassRefPtrWillBeRawPtr<D
ocument> >(webView()->mainFrame()->document()); |
206 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS
ynchronously); | 206 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS
ynchronously); |
207 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 207 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
208 | 208 |
209 WebVector<WebPageSerializer::Resource> resources; | 209 WebVector<WebPageSerializer::Resource> resources; |
210 WebPageSerializer::serialize(webView(), &resources); | 210 WebPageSerializer::serialize(webView(), &resources); |
211 ASSERT_FALSE(resources.isEmpty()); | 211 ASSERT_FALSE(resources.isEmpty()); |
212 | 212 |
213 // The first resource should be the main-frame. | 213 // The first resource should be the main-frame. |
214 const WebPageSerializer::Resource& resource = resources[0]; | 214 const WebPageSerializer::Resource& resource = resources[0]; |
215 EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); | 215 EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // exactly two times. | 453 // exactly two times. |
454 size_t nbDataURLs = 0; | 454 size_t nbDataURLs = 0; |
455 LineReader lineReader(std::string(mhtmlData.data())); | 455 LineReader lineReader(std::string(mhtmlData.data())); |
456 std::string line; | 456 std::string line; |
457 while (lineReader.getNextLine(&line)) { | 457 while (lineReader.getNextLine(&line)) { |
458 if (line.find("data:text") != std::string::npos) | 458 if (line.find("data:text") != std::string::npos) |
459 nbDataURLs++; | 459 nbDataURLs++; |
460 } | 460 } |
461 EXPECT_EQ(2u, nbDataURLs); | 461 EXPECT_EQ(2u, nbDataURLs); |
462 } | 462 } |
OLD | NEW |