OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "cc/layers/solid_color_layer.h" | 8 #include "cc/layers/solid_color_layer.h" |
9 #include "cc/test/layer_tree_test.h" | 9 #include "cc/test/layer_tree_test.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 virtual void AfterTest() OVERRIDE; | 40 virtual void AfterTest() OVERRIDE; |
41 | 41 |
42 scoped_refptr<SolidColorLayer> CreateSolidColorLayer(gfx::Rect rect, | 42 scoped_refptr<SolidColorLayer> CreateSolidColorLayer(gfx::Rect rect, |
43 SkColor color); | 43 SkColor color); |
44 scoped_refptr<SolidColorLayer> CreateSolidColorLayerWithBorder( | 44 scoped_refptr<SolidColorLayer> CreateSolidColorLayerWithBorder( |
45 gfx::Rect rect, | 45 gfx::Rect rect, |
46 SkColor color, | 46 SkColor color, |
47 int border_width, | 47 int border_width, |
48 SkColor border_color); | 48 SkColor border_color); |
49 | 49 |
50 void RunPixelTest(scoped_refptr<Layer> content_root, | 50 enum PixelTestType { |
| 51 GL_WITH_DEFAULT, |
| 52 GL_WITH_BITMAP, |
| 53 SOFTWARE_WITH_DEFAULT, |
| 54 SOFTWARE_WITH_BITMAP |
| 55 }; |
| 56 |
| 57 void RunPixelTest(PixelTestType type, |
| 58 scoped_refptr<Layer> content_root, |
51 base::FilePath file_name); | 59 base::FilePath file_name); |
52 | 60 |
53 void RunPixelTestWithReadbackTarget(scoped_refptr<Layer> content_root, | 61 void RunPixelTestWithReadbackTarget(PixelTestType type, |
| 62 scoped_refptr<Layer> content_root, |
54 Layer* target, | 63 Layer* target, |
55 base::FilePath file_name); | 64 base::FilePath file_name); |
56 | 65 |
57 scoped_ptr<SkBitmap> CopyTextureMailboxToBitmap( | 66 scoped_ptr<SkBitmap> CopyTextureMailboxToBitmap( |
58 gfx::Size size, | 67 gfx::Size size, |
59 const TextureMailbox& texture_mailbox); | 68 const TextureMailbox& texture_mailbox); |
60 | 69 |
61 // Common CSS colors defined for tests to use. | 70 // Common CSS colors defined for tests to use. |
62 enum Colors { | 71 enum Colors { |
63 kCSSOrange = 0xffffa500, | 72 kCSSOrange = 0xffffa500, |
64 kCSSBrown = 0xffa52a2a, | 73 kCSSBrown = 0xffa52a2a, |
65 kCSSGreen = 0xff008000, | 74 kCSSGreen = 0xff008000, |
66 }; | 75 }; |
67 | 76 |
68 scoped_ptr<PixelComparator> pixel_comparator_; | 77 scoped_ptr<PixelComparator> pixel_comparator_; |
69 | 78 |
70 protected: | 79 protected: |
71 bool use_gl_; | 80 PixelTestType test_type_; |
72 scoped_refptr<Layer> content_root_; | 81 scoped_refptr<Layer> content_root_; |
73 Layer* readback_target_; | 82 Layer* readback_target_; |
74 base::FilePath ref_file_; | 83 base::FilePath ref_file_; |
75 scoped_ptr<SkBitmap> result_bitmap_; | 84 scoped_ptr<SkBitmap> result_bitmap_; |
76 }; | 85 }; |
77 | 86 |
78 } // namespace cc | 87 } // namespace cc |
79 | 88 |
80 #endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_ | 89 #endif // CC_TEST_LAYER_TREE_PIXEL_TEST_H_ |
OLD | NEW |