OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "web/WebLocalFrameImpl.h" | 9 #include "web/WebLocalFrameImpl.h" |
10 #include "web/tests/FrameTestHelpers.h" | 10 #include "web/tests/FrameTestHelpers.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 // Sheet finished, but no body since it's svg so don't resume. | 170 // Sheet finished, but no body since it's svg so don't resume. |
171 cssResource.finish(); | 171 cssResource.finish(); |
172 EXPECT_TRUE(m_layerTreeView.deferCommits()); | 172 EXPECT_TRUE(m_layerTreeView.deferCommits()); |
173 | 173 |
174 // Finish the load and resume. | 174 // Finish the load and resume. |
175 mainResource.finish(); | 175 mainResource.finish(); |
176 EXPECT_FALSE(m_layerTreeView.deferCommits()); | 176 EXPECT_FALSE(m_layerTreeView.deferCommits()); |
177 } | 177 } |
178 | 178 |
| 179 TEST_F(DocumentLoadingRenderingTest, ShouldResumeImmediatelyForImageDocuments) |
| 180 { |
| 181 SimRequest mainResource("https://example.com/test.png", "image/png"); |
| 182 |
| 183 loadURL("https://example.com/test.png"); |
| 184 |
| 185 mainResource.start(); |
| 186 EXPECT_TRUE(m_layerTreeView.deferCommits()); |
| 187 |
| 188 // Not really a valid image but enough for the test. ImageDocuments should |
| 189 // resume painting as soon as the first bytes arrive. |
| 190 mainResource.write("image data"); |
| 191 EXPECT_FALSE(m_layerTreeView.deferCommits()); |
| 192 |
| 193 mainResource.finish(); |
| 194 EXPECT_FALSE(m_layerTreeView.deferCommits()); |
| 195 } |
| 196 |
179 TEST_F(DocumentLoadingRenderingTest, ShouldScheduleFrameAfterSheetsLoaded) | 197 TEST_F(DocumentLoadingRenderingTest, ShouldScheduleFrameAfterSheetsLoaded) |
180 { | 198 { |
181 SimRequest mainResource("https://example.com/test.html", "text/html"); | 199 SimRequest mainResource("https://example.com/test.html", "text/html"); |
182 SimRequest firstCssResource("https://example.com/first.css", "text/css"); | 200 SimRequest firstCssResource("https://example.com/first.css", "text/css"); |
183 SimRequest secondCssResource("https://example.com/second.css", "text/css"); | 201 SimRequest secondCssResource("https://example.com/second.css", "text/css"); |
184 | 202 |
185 loadURL("https://example.com/test.html"); | 203 loadURL("https://example.com/test.html"); |
186 | 204 |
187 mainResource.start(); | 205 mainResource.start(); |
188 | 206 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 cssResource.start(); | 295 cssResource.start(); |
278 cssResource.finish(); | 296 cssResource.finish(); |
279 | 297 |
280 // First frame where all frames are loaded, should paint the text in the | 298 // First frame where all frames are loaded, should paint the text in the |
281 // child frame. | 299 // child frame. |
282 auto frame3 = m_compositor.beginFrame(); | 300 auto frame3 = m_compositor.beginFrame(); |
283 EXPECT_TRUE(frame3.containsText()); | 301 EXPECT_TRUE(frame3.containsText()); |
284 } | 302 } |
285 | 303 |
286 } // namespace blink | 304 } // namespace blink |
OLD | NEW |