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