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

Side by Side Diff: Source/web/PageOverlayTest.cpp

Issue 1154313004: Stop using deprecatedCreateWithCanvas in SP mode in PageOverlayTest. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 "config.h" 5 #include "config.h"
6 #include "web/PageOverlay.h" 6 #include "web/PageOverlay.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "platform/graphics/Color.h" 10 #include "platform/graphics/Color.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 // Ideally, we would get results from the compositor that showed that this 188 // Ideally, we would get results from the compositor that showed that this
189 // page overlay actually winds up getting drawn on top of the rest. 189 // page overlay actually winds up getting drawn on top of the rest.
190 // For now, we just check that the GraphicsLayer will draw the right thing. 190 // For now, we just check that the GraphicsLayer will draw the right thing.
191 191
192 MockCanvas canvas(viewportWidth, viewportHeight); 192 MockCanvas canvas(viewportWidth, viewportHeight);
193 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0)); 193 EXPECT_CALL(canvas, onDrawRect(_, _)).Times(AtLeast(0));
194 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight) , Property(&SkPaint::getColor, SK_ColorYELLOW))); 194 EXPECT_CALL(canvas, onDrawRect(SkRect::MakeWH(viewportWidth, viewportHeight) , Property(&SkPaint::getColor, SK_ColorYELLOW)));
195 195
196 GraphicsLayer* graphicsLayer = webViewImpl()->pageOverlays()->graphicsLayerF orTesting(); 196 GraphicsLayer* graphicsLayer = webViewImpl()->pageOverlays()->graphicsLayerF orTesting();
197 WebRect rect(0, 0, viewportWidth, viewportHeight);
197 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 198 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
198 // If slimming paint is on, we paint the layer with a null canvas to get 199 // If slimming paint is on, we paint the layer with a null canvas to get
199 // a display list, and then replay that onto the mock canvas for 200 // a display list, and then replay that onto the mock canvas for
200 // examination. This is about as close to the real path as we can easily 201 // examination. This is about as close to the real path as we can easily
201 // get. 202 // get.
202 GraphicsContext graphicsContext(graphicsLayer->displayItemList()); 203 GraphicsContext graphicsContext(graphicsLayer->displayItemList());
203 graphicsLayer->paint(graphicsContext, WebRect(0, 0, viewportWidth, viewp ortHeight)); 204 graphicsLayer->paint(graphicsContext, rect);
204 205
205 OwnPtr<GraphicsContext> replayContext = GraphicsContext::deprecatedCreat eWithCanvas(&canvas); 206 graphicsContext.beginRecording(IntRect(rect));
206 graphicsLayer->displayItemList()->commitNewDisplayItemsAndReplay(*replay Context); 207 graphicsLayer->displayItemList()->commitNewDisplayItemsAndReplay(graphic sContext);
208 graphicsContext.endRecording()->playback(&canvas);
207 } else { 209 } else {
208 OwnPtr<GraphicsContext> graphicsContext = GraphicsContext::deprecatedCre ateWithCanvas(&canvas); 210 OwnPtr<GraphicsContext> graphicsContext = GraphicsContext::deprecatedCre ateWithCanvas(&canvas);
209 graphicsLayer->paint(*graphicsContext, WebRect(0, 0, viewportWidth, view portHeight)); 211 graphicsLayer->paint(*graphicsContext, rect);
210 } 212 }
211 } 213 }
212 214
213 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_NoSlimmingPai nt) 215 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_NoSlimmingPai nt)
214 { 216 {
215 SlimmingPaintScope slimmingPaintEnabled(false); 217 SlimmingPaintScope slimmingPaintEnabled(false);
216 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); 218 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>();
217 } 219 }
218 220
219 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_SlimmingPaint ) 221 TEST_F(PageOverlayTest, SimpleCanvasOverlay_AcceleratedCompositing_SlimmingPaint )
220 { 222 {
221 SlimmingPaintScope slimmingPaintEnabled(true); 223 SlimmingPaintScope slimmingPaintEnabled(true);
222 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>(); 224 runPageOverlayTestWithAcceleratedCompositing<SimpleCanvasOverlay>();
223 } 225 }
224 226
225 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_NoS limmingPaint) 227 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_NoS limmingPaint)
226 { 228 {
227 SlimmingPaintScope slimmingPaintEnabled(false); 229 SlimmingPaintScope slimmingPaintEnabled(false);
228 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); 230 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( );
229 } 231 }
230 232
231 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint) 233 TEST_F(PageOverlayTest, PrivateGraphicsContextOverlay_AcceleratedCompositing_Sli mmingPaint)
232 { 234 {
233 SlimmingPaintScope slimmingPaintEnabled(true); 235 SlimmingPaintScope slimmingPaintEnabled(true);
234 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( ); 236 runPageOverlayTestWithAcceleratedCompositing<PrivateGraphicsContextOverlay>( );
235 } 237 }
236 238
237 } // namespace 239 } // namespace
238 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698