Chromium Code Reviews| 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 "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "platform/testing/UnitTestHelpers.h" | 6 #include "platform/testing/UnitTestHelpers.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "web/tests/sim/SimCompositor.h" | 8 #include "web/tests/sim/SimCompositor.h" |
| 9 #include "web/tests/sim/SimDisplayItemList.h" | 9 #include "web/tests/sim/SimDisplayItemList.h" |
| 10 #include "web/tests/sim/SimRequest.h" | 10 #include "web/tests/sim/SimRequest.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 // Pump the message loop to process the iframe loading task. | 167 // Pump the message loop to process the iframe loading task. |
| 168 testing::runPendingTasks(); | 168 testing::runPendingTasks(); |
| 169 | 169 |
| 170 compositor().beginFrame(); | 170 compositor().beginFrame(); |
| 171 | 171 |
| 172 EXPECT_EQ(1, webViewClient().visuallyNonEmptyLayoutCount()); | 172 EXPECT_EQ(1, webViewClient().visuallyNonEmptyLayoutCount()); |
| 173 EXPECT_EQ(1, webViewClient().finishedParsingLayoutCount()); | 173 EXPECT_EQ(1, webViewClient().finishedParsingLayoutCount()); |
| 174 EXPECT_EQ(1, webViewClient().finishedLoadingLayoutCount()); | 174 EXPECT_EQ(1, webViewClient().finishedLoadingLayoutCount()); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // NoOverflowInIncrementVisuallyNonEmptyPixelCount tests fail if the number of | |
| 178 // pixels is calculated in 32-bit integer, because 65536 * 65536 would become 0 | |
| 179 // if it was calculated in 32-bit and thus it would be considered as empty. | |
| 180 TEST_F(WebMeaningfulLayoutsTest, NoOverflowInIncrementVisuallyNonEmptyPixelCount ) | |
| 181 { | |
| 182 SimRequest mainResource("https://example.com/test.html", "text/html"); | |
| 183 SimRequest svgResource("https://example.com/test.svg", "image/svg+xml"); | |
| 184 | |
| 185 loadURL("https://example.com/test.html"); | |
| 186 | |
| 187 mainResource.start(); | |
| 188 mainResource.write("<DOCTYPE html><body><img src=\"test.svg\">"); | |
| 189 testing::runPendingTasks(); | |
|
esprehn
2016/08/15 15:59:39
What task are you trying to run here?
hiroshige
2016/09/29 08:25:55
Added a comment.
| |
| 190 EXPECT_EQ(0, webViewClient().visuallyNonEmptyLayoutCount()); | |
| 191 | |
| 192 // We serve the SVG file and check visuallyNonEmptyLayoutCount() before | |
| 193 // mainResource.finish() because finishing the main resource causes | |
| 194 // |FrameView::m_isVisuallyNonEmpty| to be true and | |
| 195 // visuallyNonEmptyLayoutCount() to be 1 irrespective of the SVG sizes. | |
| 196 svgResource.start(); | |
| 197 svgResource.write("<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"65536\ " width=\"65536\"></svg>"); | |
| 198 svgResource.finish(); | |
| 199 webView().updateAllLifecyclePhases(); | |
|
esprehn
2016/08/15 15:59:39
compositor().beginFrame() ?
hiroshige
2016/09/29 08:25:55
Done.
| |
| 200 EXPECT_EQ(1, webViewClient().visuallyNonEmptyLayoutCount()); | |
| 201 | |
| 202 mainResource.finish(); | |
| 203 } | |
| 204 | |
| 177 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |