Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebMeaningfulLayoutsTest.cpp

Issue 2229753002: Test that FrameView::incrementVisuallyNonEmptyPixelCount() doesn't overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reflect comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameViewTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Run pending tasks to initiate the request to test.svg.
190 testing::runPendingTasks();
191 EXPECT_EQ(0, webViewClient().visuallyNonEmptyLayoutCount());
192
193 // We serve the SVG file and check visuallyNonEmptyLayoutCount() before
194 // mainResource.finish() because finishing the main resource causes
195 // |FrameView::m_isVisuallyNonEmpty| to be true and
196 // visuallyNonEmptyLayoutCount() to be 1 irrespective of the SVG sizes.
197 svgResource.start();
198 svgResource.write("<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"65536\ " width=\"65536\"></svg>");
199 svgResource.finish();
200 compositor().beginFrame();
201 EXPECT_EQ(1, webViewClient().visuallyNonEmptyLayoutCount());
202
203 mainResource.finish();
204 }
205
177 } // namespace blink 206 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameViewTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698