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

Side by Side Diff: Source/platform/graphics/OpaqueRectTrackingContentLayerDelegateTest.cpp

Issue 216423011: Move remained platform tests from web/tests/ to platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #include "platform/graphics/OpaqueRectTrackingContentLayerDelegate.h" 27 #include "platform/graphics/OpaqueRectTrackingContentLayerDelegate.h"
28 28
29 #include "platform/geometry/IntRect.h" 29 #include "platform/geometry/IntRect.h"
30 #include "platform/graphics/Color.h" 30 #include "platform/graphics/Color.h"
31 #include "platform/graphics/GraphicsContext.h" 31 #include "platform/graphics/GraphicsContext.h"
32 #include "skia/ext/platform_canvas.h"
33 #include "public/platform/WebFloatRect.h" 32 #include "public/platform/WebFloatRect.h"
34 #include "public/platform/WebRect.h" 33 #include "public/platform/WebRect.h"
34 #include "skia/ext/platform_canvas.h"
35 35
36 #include <gtest/gtest.h> 36 #include <gtest/gtest.h>
37 37
38 using blink::WebRect; 38 using blink::WebRect;
39 using blink::WebFloatRect; 39 using blink::WebFloatRect;
40 using namespace WebCore; 40 using namespace WebCore;
41 41
42 namespace { 42 namespace {
43 43
44 struct PaintCallback { 44 struct PaintCallback {
45 virtual void operator()(GraphicsContext&, const IntRect&) = 0; 45 virtual void operator()(GraphicsContext&, const IntRect&) = 0;
46 }; 46 };
47 47
48 class TestLayerPainterChromium : public GraphicsContextPainter { 48 class TestLayerPainterChromium : public GraphicsContextPainter {
49 public: 49 public:
50 TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { } 50 TestLayerPainterChromium(PaintCallback& callback) : m_callback(callback) { }
51 51
52 virtual void paint(GraphicsContext& context, const IntRect& contentRect) OVE RRIDE 52 virtual void paint(GraphicsContext& context, const IntRect& contentRect) OVE RRIDE
53 { 53 {
54 m_callback(context, contentRect); 54 m_callback(context, contentRect);
55 } 55 }
56 56
57 private: 57 private:
58 PaintCallback& m_callback; 58 PaintCallback& m_callback;
59 }; 59 };
60 60
61 // Paint callback functions 61 // Paint callback functions
62 62
63 struct PaintFillOpaque : public PaintCallback { 63 struct PaintFillOpaque : public PaintCallback {
64 virtual void operator()(GraphicsContext& context, const IntRect& contentRect ) OVERRIDE 64 virtual void operator()(GraphicsContext& context, const IntRect& contentRect ) OVERRIDE
65 { 65 {
66 Color opaque(255, 0, 0, 255); 66 Color opaque(255, 0, 0, 255);
67 IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), conte ntRect.height() / 2); 67 IntRect top(contentRect.x(), contentRect.y(), contentRect.width(), conte ntRect.height() / 2);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 TestLayerPainterChromium painter(fillPartial); 188 TestLayerPainterChromium painter(fillPartial);
189 OpaqueRectTrackingContentLayerDelegate delegate(&painter); 189 OpaqueRectTrackingContentLayerDelegate delegate(&painter);
190 190
191 WebFloatRect opaqueRect; 191 WebFloatRect opaqueRect;
192 WebRect contentRect(11, 12, 389, 388); 192 WebRect contentRect(11, 12, 389, 388);
193 delegate.paintContents(skCanvas(), contentRect, false, opaqueRect); 193 delegate.paintContents(skCanvas(), contentRect, false, opaqueRect);
194 EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.wi dth(), partialRect.height()), opaqueRect); 194 EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.wi dth(), partialRect.height()), opaqueRect);
195 } 195 }
196 196
197 } // namespace 197 } // namespace
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageLayerChromiumTest.cpp ('k') | Source/platform/graphics/filters/FilterOperationsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698