OLD | NEW |
| (Empty) |
1 // Copyright 2014 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. | |
4 | |
5 #ifndef CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ | |
6 #define CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "cc/test/layer_tree_pixel_test.h" | |
10 | |
11 namespace cc { | |
12 | |
13 class LayerTreeHostImpl; | |
14 class TileTaskWorkerPool; | |
15 class ResourcePool; | |
16 | |
17 // Enumerate the various combinations of renderer, resource pool, staging | |
18 // texture type, and drawing texture types. Not all of the combinations | |
19 // are possible (or worth testing independently), so this is the minimal | |
20 // list to hit all codepaths. | |
21 enum PixelResourceTestCase { | |
22 SOFTWARE, | |
23 GL_GPU_RASTER_2D_DRAW, | |
24 GL_ONE_COPY_2D_STAGING_2D_DRAW, | |
25 GL_ONE_COPY_RECT_STAGING_2D_DRAW, | |
26 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, | |
27 GL_ZERO_COPY_2D_DRAW, | |
28 GL_ZERO_COPY_RECT_DRAW, | |
29 GL_ZERO_COPY_EXTERNAL_DRAW, | |
30 GL_ASYNC_UPLOAD_2D_DRAW, | |
31 }; | |
32 | |
33 class LayerTreeHostPixelResourceTest : public LayerTreePixelTest { | |
34 public: | |
35 explicit LayerTreeHostPixelResourceTest(PixelResourceTestCase test_case); | |
36 LayerTreeHostPixelResourceTest(); | |
37 | |
38 scoped_ptr<Rasterizer> CreateRasterizer( | |
39 LayerTreeHostImpl* host_impl) override; | |
40 void CreateResourceAndTileTaskWorkerPool( | |
41 LayerTreeHostImpl* host_impl, | |
42 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | |
43 scoped_ptr<ResourcePool>* resource_pool, | |
44 scoped_ptr<ResourcePool>* staging_resource_pool) override; | |
45 | |
46 void RunPixelResourceTest(scoped_refptr<Layer> content_root, | |
47 base::FilePath file_name); | |
48 | |
49 enum TileTaskWorkerPoolOption { | |
50 BITMAP_TILE_TASK_WORKER_POOL, | |
51 GPU_TILE_TASK_WORKER_POOL, | |
52 ZERO_COPY_TILE_TASK_WORKER_POOL, | |
53 ONE_COPY_TILE_TASK_WORKER_POOL, | |
54 PIXEL_BUFFER_TILE_TASK_WORKER_POOL, | |
55 }; | |
56 | |
57 protected: | |
58 unsigned staging_texture_target_; | |
59 unsigned draw_texture_target_; | |
60 TileTaskWorkerPoolOption resource_pool_option_; | |
61 bool initialized_; | |
62 | |
63 void InitializeFromTestCase(PixelResourceTestCase test_case); | |
64 | |
65 private: | |
66 PixelResourceTestCase test_case_; | |
67 }; | |
68 | |
69 #define INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(framework_name) \ | |
70 INSTANTIATE_TEST_CASE_P( \ | |
71 PixelResourceTest, \ | |
72 framework_name, \ | |
73 ::testing::Values(SOFTWARE, \ | |
74 GL_GPU_RASTER_2D_DRAW, \ | |
75 GL_ONE_COPY_2D_STAGING_2D_DRAW, \ | |
76 GL_ONE_COPY_RECT_STAGING_2D_DRAW, \ | |
77 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, \ | |
78 GL_ZERO_COPY_2D_DRAW, \ | |
79 GL_ZERO_COPY_RECT_DRAW, \ | |
80 GL_ZERO_COPY_EXTERNAL_DRAW, \ | |
81 GL_ASYNC_UPLOAD_2D_DRAW)) | |
82 | |
83 class ParameterizedPixelResourceTest | |
84 : public LayerTreeHostPixelResourceTest, | |
85 public ::testing::WithParamInterface<PixelResourceTestCase> { | |
86 public: | |
87 ParameterizedPixelResourceTest(); | |
88 }; | |
89 | |
90 } // namespace cc | |
91 | |
92 #endif // CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ | |
OLD | NEW |