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: Source/web/tests/WebViewTest.cpp

Issue 540033002: use tryAllocPixels to check the result, allocPixels to require success (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 | « Source/web/tests/WebFrameTest.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 /* 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 WebView* webView = m_webViewHelper.initialize(); 299 WebView* webView = m_webViewHelper.initialize();
300 300
301 // Set WebView background to green with alpha. 301 // Set WebView background to green with alpha.
302 webView->setBaseBackgroundColor(kAlphaGreen); 302 webView->setBaseBackgroundColor(kAlphaGreen);
303 webView->settings()->setShouldClearDocumentBackground(false); 303 webView->settings()->setShouldClearDocumentBackground(false);
304 webView->resize(WebSize(kWidth, kHeight)); 304 webView->resize(WebSize(kWidth, kHeight));
305 webView->layout(); 305 webView->layout();
306 306
307 // Set canvas background to red with alpha. 307 // Set canvas background to red with alpha.
308 SkBitmap bitmap; 308 SkBitmap bitmap;
309 ASSERT_TRUE(bitmap.allocN32Pixels(kWidth, kHeight)); 309 bitmap.allocN32Pixels(kWidth, kHeight);
310 SkCanvas canvas(bitmap); 310 SkCanvas canvas(bitmap);
311 canvas.clear(kAlphaRed); 311 canvas.clear(kAlphaRed);
312 312
313 blink::GraphicsContext context(&canvas); 313 blink::GraphicsContext context(&canvas);
314 314
315 // Paint the root of the main frame in the way that CompositedLayerMapping w ould. 315 // Paint the root of the main frame in the way that CompositedLayerMapping w ould.
316 blink::FrameView* view = m_webViewHelper.webViewImpl()->mainFrameImpl()->fra meView(); 316 blink::FrameView* view = m_webViewHelper.webViewImpl()->mainFrameImpl()->fra meView();
317 blink::RenderLayer* rootLayer = view->renderView()->layer(); 317 blink::RenderLayer* rootLayer = view->renderView()->layer();
318 blink::IntRect paintRect(0, 0, kWidth, kHeight); 318 blink::IntRect paintRect(0, 0, kWidth, kHeight);
319 blink::LayerPaintingInfo paintingInfo(rootLayer, paintRect, blink::PaintBeha viorNormal, blink::LayoutSize()); 319 blink::LayerPaintingInfo paintingInfo(rootLayer, paintRect, blink::PaintBeha viorNormal, blink::LayoutSize());
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 loadFrame(webView->mainFrame(), url); 2179 loadFrame(webView->mainFrame(), url);
2180 2180
2181 blink::FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl() ->frameView(); 2181 blink::FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl() ->frameView();
2182 2182
2183 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T his EXPECT is 2183 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T his EXPECT is
2184 // merely a dummy. The real test is that we don't trigger asserts in debug b uilds. 2184 // merely a dummy. The real test is that we don't trigger asserts in debug b uilds.
2185 EXPECT_FALSE(frameView->needsLayout()); 2185 EXPECT_FALSE(frameView->needsLayout());
2186 }; 2186 };
2187 2187
2188 } // namespace 2188 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698