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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // If we don't register a mocked resource for awesome.png, it causes the | 156 // If we don't register a mocked resource for awesome.png, it causes the |
157 // document loader of the iframe that has it as its src to assert on close, | 157 // document loader of the iframe that has it as its src to assert on close, |
158 // not sure why. | 158 // not sure why. |
159 registerMockedURLLoad("http://www.test.com/awesome.png", | 159 registerMockedURLLoad("http://www.test.com/awesome.png", |
160 WebString::fromUTF8("awesome.png")); | 160 WebString::fromUTF8("awesome.png")); |
161 | 161 |
162 loadURLInTopFrame(topFrameURL); | 162 loadURLInTopFrame(topFrameURL); |
163 // OBJECT/EMBED have some delay to start to load their content. The first | 163 // OBJECT/EMBED have some delay to start to load their content. The first |
164 // serveAsynchronousMockedRequests call in loadURLInTopFrame() finishes | 164 // serveAsynchronousMockedRequests call in loadURLInTopFrame() finishes |
165 // before the start. | 165 // before the start. |
166 RefPtr<Document> document = static_cast<PassRefPtr<Document> >(webView()->ma
inFrame()->document()); | 166 RefPtrWillBeRawPtr<Document> document = static_cast<PassRefPtrWillBeRawPtr<D
ocument> >(webView()->mainFrame()->document()); |
167 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS
ynchronously); | 167 document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksS
ynchronously); |
168 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 168 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
169 | 169 |
170 // Retrieve all resources. | 170 // Retrieve all resources. |
171 WebVector<WebURL> frames; | 171 WebVector<WebURL> frames; |
172 WebVector<WebURL> resources; | 172 WebVector<WebURL> resources; |
173 ASSERT_TRUE(WebPageSerializer::retrieveAllResources( | 173 ASSERT_TRUE(WebPageSerializer::retrieveAllResources( |
174 webView(), m_supportedSchemes, &resources, &frames)); | 174 webView(), m_supportedSchemes, &resources, &frames)); |
175 | 175 |
176 // Tests that all resources from the frame have been retrieved. | 176 // Tests that all resources from the frame have been retrieved. |
177 EXPECT_EQ(4U, frames.size()); // There should be no duplicates. | 177 EXPECT_EQ(4U, frames.size()); // There should be no duplicates. |
178 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com")); | 178 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com")); |
179 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/simple_iframe.htm
l")); | 179 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/simple_iframe.htm
l")); |
180 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/object_iframe.htm
l")); | 180 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/object_iframe.htm
l")); |
181 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/embed_iframe.html
")); | 181 EXPECT_TRUE(webVectorContains(frames, "http://www.test.com/embed_iframe.html
")); |
182 | 182 |
183 EXPECT_EQ(5U, resources.size()); // There should be no duplicates. | 183 EXPECT_EQ(5U, resources.size()); // There should be no duplicates. |
184 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/awesome.png"))
; | 184 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/awesome.png"))
; |
185 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/innerFrame.png
")); | 185 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/innerFrame.png
")); |
186 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/flash.swf")); | 186 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/flash.swf")); |
187 // FIXME: for some reason the following resources is missing on one of the b
ot | 187 // FIXME: for some reason the following resources is missing on one of the b
ot |
188 // causing the test to fail. Probably a plugin issue. | 188 // causing the test to fail. Probably a plugin issue. |
189 // EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/music.mid")
); | 189 // EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/music.mid")
); |
190 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/object.png")); | 190 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/object.png")); |
191 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/embed.png")); | 191 EXPECT_TRUE(webVectorContains(resources, "http://www.test.com/embed.png")); |
192 } | 192 } |
193 | 193 |
194 } | 194 } |
OLD | NEW |