OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 5267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5278 TEST_F(WebFrameTest, CreateChildFrameFailure) | 5278 TEST_F(WebFrameTest, CreateChildFrameFailure) |
5279 { | 5279 { |
5280 registerMockedHttpURLLoad("create_child_frame_fail.html"); | 5280 registerMockedHttpURLLoad("create_child_frame_fail.html"); |
5281 FailCreateChildFrame client; | 5281 FailCreateChildFrame client; |
5282 FrameTestHelpers::WebViewHelper webViewHelper; | 5282 FrameTestHelpers::WebViewHelper webViewHelper; |
5283 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); | 5283 webViewHelper.initializeAndLoad(m_baseURL + "create_child_frame_fail.html",
true, &client); |
5284 | 5284 |
5285 EXPECT_EQ(1, client.callCount()); | 5285 EXPECT_EQ(1, client.callCount()); |
5286 } | 5286 } |
5287 | 5287 |
| 5288 TEST_F(WebFrameTest, sizeChangeRepaint) |
| 5289 { |
| 5290 const char* kTests[] = { |
| 5291 "repaint/size-change-repaint1.html", |
| 5292 "repaint/size-change-repaint2.html", |
| 5293 "repaint/size-change-repaint3.html", |
| 5294 "repaint/size-change-repaint4.html", |
| 5295 "repaint/size-change-repaint5.html", |
| 5296 "repaint/size-change-repaint6.html", |
| 5297 "repaint/size-change-repaint7.html", |
| 5298 "repaint/size-change-repaint8.html", |
| 5299 "repaint/size-change-repaint9.html", |
| 5300 "repaint/size-change-repaint10.html", |
| 5301 }; |
| 5302 |
| 5303 const WebCore::IntRect kExpectedRepaintOnHeightChange[] = { |
| 5304 WebCore::IntRect(0, 200, 200, 100), |
| 5305 WebCore::IntRect(0, 200, 200, 100), |
| 5306 WebCore::IntRect(0, 200, 200, 100), |
| 5307 WebCore::IntRect(0, 0, 200, 300), |
| 5308 WebCore::IntRect(0, 0, 200, 300), |
| 5309 WebCore::IntRect(0, 0, 200, 300), |
| 5310 WebCore::IntRect(0, 100, 200, 200), |
| 5311 WebCore::IntRect(0, 100, 200, 200), |
| 5312 WebCore::IntRect(0, 160, 200, 140), |
| 5313 WebCore::IntRect(0, 50, 200, 250), |
| 5314 }; |
| 5315 |
| 5316 const WebCore::IntRect kExpectedRepaintOnWidthChange[] = { |
| 5317 WebCore::IntRect(0, 0, 300, 300), |
| 5318 WebCore::IntRect(0, 0, 300, 300), |
| 5319 WebCore::IntRect(0, 0, 300, 300), |
| 5320 WebCore::IntRect(0, 0, 300, 300), |
| 5321 WebCore::IntRect(0, 0, 300, 300), |
| 5322 WebCore::IntRect(0, 0, 300, 300), |
| 5323 WebCore::IntRect(0, 0, 300, 300), |
| 5324 WebCore::IntRect(0, 0, 300, 300), |
| 5325 WebCore::IntRect(0, 0, 300, 300), |
| 5326 WebCore::IntRect(0, 0, 300, 300), |
| 5327 }; |
| 5328 |
| 5329 UseMockScrollbarSettings mockScrollbarSettings; |
| 5330 |
| 5331 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5332 WebViewImpl* webView = webViewHelper.initialize(true); |
| 5333 |
| 5334 for (size_t i = 0; i < arraysize(kTests); ++i) { |
| 5335 SCOPED_TRACE(kTests[i]); |
| 5336 registerMockedHttpURLLoad(kTests[i]); |
| 5337 FrameTestHelpers::loadFrame(webView->mainFrame(), m_baseURL + kTests[i])
; |
| 5338 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(
); |
| 5339 |
| 5340 webView->resize(WebSize(200, 200)); |
| 5341 webView->layout(); |
| 5342 |
| 5343 // Change height. |
| 5344 WebCore::FrameView* frameView = webView->mainFrameImpl()->frameView(); |
| 5345 frameView->setTracksRepaints(true); |
| 5346 webView->resize(WebSize(200, 300)); |
| 5347 webView->layout(); |
| 5348 WebCore::IntRect repaintRect = WebCore::intersection(WebCore::IntRect(0,
0, 200, 300), WebCore::unionRect(frameView->trackedRepaintRects())); |
| 5349 EXPECT_EQ_RECT(kExpectedRepaintOnHeightChange[i], repaintRect); |
| 5350 |
| 5351 // Change width. |
| 5352 frameView->setTracksRepaints(true); |
| 5353 webView->resize(WebSize(300, 300)); |
| 5354 webView->layout(); |
| 5355 repaintRect = WebCore::intersection(WebCore::IntRect(0, 0, 300, 300), We
bCore::unionRect(frameView->trackedRepaintRects())); |
| 5356 EXPECT_EQ_RECT(kExpectedRepaintOnWidthChange[i], repaintRect); |
| 5357 frameView->setTracksRepaints(false); |
| 5358 } |
| 5359 } |
| 5360 |
5288 TEST_F(WebFrameTest, fixedPositionInFixedViewport) | 5361 TEST_F(WebFrameTest, fixedPositionInFixedViewport) |
5289 { | 5362 { |
5290 UseMockScrollbarSettings mockScrollbarSettings; | 5363 UseMockScrollbarSettings mockScrollbarSettings; |
5291 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); | 5364 registerMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); |
5292 FrameTestHelpers::WebViewHelper webViewHelper; | 5365 FrameTestHelpers::WebViewHelper webViewHelper; |
5293 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, 0, 0, enableViewportSettings); | 5366 webViewHelper.initializeAndLoad(m_baseURL + "fixed-position-in-fixed-viewpor
t.html", true, 0, 0, enableViewportSettings); |
5294 | 5367 |
5295 WebView* webView = webViewHelper.webView(); | 5368 WebView* webView = webViewHelper.webView(); |
5296 webView->resize(WebSize(100, 100)); | 5369 webView->resize(WebSize(100, 100)); |
5297 webView->layout(); | 5370 webView->layout(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5392 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); | 5465 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); |
5393 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA
nonymous)); | 5466 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA
nonymous)); |
5394 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir
ectChild)); | 5467 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir
ectChild)); |
5395 | 5468 |
5396 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB
lock(); | 5469 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB
lock(); |
5397 EXPECT_TRUE(anonymousBlock->isAnonymous()); | 5470 EXPECT_TRUE(anonymousBlock->isAnonymous()); |
5398 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants()); | 5471 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants()); |
5399 } | 5472 } |
5400 | 5473 |
5401 } // namespace | 5474 } // namespace |
OLD | NEW |