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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Rebase Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 // Set WebView background to green with alpha. 455 // Set WebView background to green with alpha.
456 webView->setBaseBackgroundColor(kAlphaGreen); 456 webView->setBaseBackgroundColor(kAlphaGreen);
457 webView->settings()->setShouldClearDocumentBackground(false); 457 webView->settings()->setShouldClearDocumentBackground(false);
458 webView->resize(WebSize(kWidth, kHeight)); 458 webView->resize(WebSize(kWidth, kHeight));
459 webView->updateAllLifecyclePhases(); 459 webView->updateAllLifecyclePhases();
460 460
461 // Set canvas background to red with alpha. 461 // Set canvas background to red with alpha.
462 SkBitmap bitmap; 462 SkBitmap bitmap;
463 bitmap.allocN32Pixels(kWidth, kHeight); 463 bitmap.allocN32Pixels(kWidth, kHeight);
464 SkCanvas canvas(bitmap); 464 SkCanvas bitmapCanvas(bitmap);
465 canvas.clear(kAlphaRed); 465 bitmapCanvas.clear(kAlphaRed);
466
467 PaintCanvasPassThrough canvas(&bitmapCanvas);
466 468
467 SkPictureBuilder pictureBuilder(FloatRect(0, 0, kWidth, kHeight)); 469 SkPictureBuilder pictureBuilder(FloatRect(0, 0, kWidth, kHeight));
468 470
469 // Paint the root of the main frame in the way that CompositedLayerMapping 471 // Paint the root of the main frame in the way that CompositedLayerMapping
470 // would. 472 // would.
471 FrameView* view = m_webViewHelper.webView()->mainFrameImpl()->frameView(); 473 FrameView* view = m_webViewHelper.webView()->mainFrameImpl()->frameView();
472 PaintLayer* rootLayer = view->layoutViewItem().layer(); 474 PaintLayer* rootLayer = view->layoutViewItem().layer();
473 LayoutRect paintRect(0, 0, kWidth, kHeight); 475 LayoutRect paintRect(0, 0, kWidth, kHeight);
474 PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect, 476 PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect,
475 GlobalPaintNormalPhase, LayoutSize()); 477 GlobalPaintNormalPhase, LayoutSize());
476 PaintLayerPainter(*rootLayer) 478 PaintLayerPainter(*rootLayer)
477 .paintLayerContents(pictureBuilder.context(), paintingInfo, 479 .paintLayerContents(pictureBuilder.context(), paintingInfo,
478 PaintLayerPaintingCompositingAllPhases); 480 PaintLayerPaintingCompositingAllPhases);
479
480 pictureBuilder.endRecording()->playback(&canvas); 481 pictureBuilder.endRecording()->playback(&canvas);
481 482
482 // The result should be a blend of red and green. 483 // The result should be a blend of red and green.
483 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2); 484 SkColor color = bitmap.getColor(kWidth / 2, kHeight / 2);
484 EXPECT_TRUE(redChannel(color)); 485 EXPECT_TRUE(redChannel(color));
485 EXPECT_TRUE(greenChannel(color)); 486 EXPECT_TRUE(greenChannel(color));
486 } 487 }
487 488
488 TEST_P(WebViewTest, FocusIsInactive) { 489 TEST_P(WebViewTest, FocusIsInactive) {
489 URLTestHelpers::registerMockedURLFromBaseURL( 490 URLTestHelpers::registerMockedURLFromBaseURL(
(...skipping 3892 matching lines...) Expand 10 before | Expand all | Expand 10 after
4382 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); 4383 EXPECT_EQ(expectedWidth, vwElement->offsetWidth());
4383 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); 4384 EXPECT_EQ(expectedHeight, vwElement->offsetHeight());
4384 4385
4385 webView->resize(WebSize(800, 600)); 4386 webView->resize(WebSize(800, 600));
4386 frame->printEnd(); 4387 frame->printEnd();
4387 4388
4388 EXPECT_EQ(800, vwElement->offsetWidth()); 4389 EXPECT_EQ(800, vwElement->offsetWidth());
4389 } 4390 }
4390 4391
4391 } // namespace blink 4392 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698