1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/files/file_path.h"
6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "cc/layers/solid_color_layer.h"
9 #include "cc/test/layer_tree_test.h"
11 #ifndef CC_TEST_LAYER_TREE_PIXEL_TEST_H_
12 #define CC_TEST_LAYER_TREE_PIXEL_TEST_H_
16 class PixelComparator
;
18 class LayerTreePixelTest
: public LayerTreeTest
{
21 virtual ~LayerTreePixelTest();
23 virtual scoped_ptr
<OutputSurface
> CreateOutputSurface() OVERRIDE
;
24 virtual scoped_refptr
<cc::ContextProvider
>
25 OffscreenContextProviderForMainThread() OVERRIDE
;
26 virtual scoped_refptr
<cc::ContextProvider
>
27 OffscreenContextProviderForCompositorThread() OVERRIDE
;
29 void ReadbackResult(scoped_ptr
<SkBitmap
> bitmap
);
31 virtual void BeginTest() OVERRIDE
;
32 virtual void SetupTree() OVERRIDE
;
33 virtual void AfterTest() OVERRIDE
;
35 scoped_refptr
<SolidColorLayer
> CreateSolidColorLayer(gfx::Rect rect
,
37 scoped_refptr
<SolidColorLayer
> CreateSolidColorLayerWithBorder(
41 SkColor border_color
);
43 void RunPixelTest(scoped_refptr
<Layer
> content_root
,
44 base::FilePath file_name
);
46 void RunPixelTestWithReadbackTarget(scoped_refptr
<Layer
> content_root
,
48 base::FilePath file_name
);
50 // Common CSS colors defined for tests to use.
52 kCSSOrange
= 0xffffa500,
53 kCSSBrown
= 0xffa52a2a,
54 kCSSGreen
= 0xff008000,
57 scoped_ptr
<PixelComparator
> pixel_comparator_
;
60 scoped_refptr
<Layer
> content_root_
;
61 Layer
* readback_target_
;
62 base::FilePath ref_file_
;
67 #endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_