| 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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 Layer::LayerMaskType mask_type); |
| 35 LayerTreeHostPixelResourceTest(); | 36 LayerTreeHostPixelResourceTest(); |
| 36 | 37 |
| 37 void CreateResourceAndRasterBufferProvider( | 38 void CreateResourceAndRasterBufferProvider( |
| 38 LayerTreeHostImpl* host_impl, | 39 LayerTreeHostImpl* host_impl, |
| 39 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider, | 40 std::unique_ptr<RasterBufferProvider>* raster_buffer_provider, |
| 40 std::unique_ptr<ResourcePool>* resource_pool) override; | 41 std::unique_ptr<ResourcePool>* resource_pool) override; |
| 41 | 42 |
| 42 void RunPixelResourceTest(scoped_refptr<Layer> content_root, | 43 void RunPixelResourceTest(scoped_refptr<Layer> content_root, |
| 43 base::FilePath file_name); | 44 base::FilePath file_name); |
| 44 | 45 |
| 45 enum RasterBufferProviderType { | 46 enum RasterBufferProviderType { |
| 46 RASTER_BUFFER_PROVIDER_TYPE_ZERO_COPY, | 47 RASTER_BUFFER_PROVIDER_TYPE_ZERO_COPY, |
| 47 RASTER_BUFFER_PROVIDER_TYPE_ONE_COPY, | 48 RASTER_BUFFER_PROVIDER_TYPE_ONE_COPY, |
| 48 RASTER_BUFFER_PROVIDER_TYPE_GPU, | 49 RASTER_BUFFER_PROVIDER_TYPE_GPU, |
| 49 RASTER_BUFFER_PROVIDER_TYPE_BITMAP | 50 RASTER_BUFFER_PROVIDER_TYPE_BITMAP |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 protected: | 53 protected: |
| 53 unsigned draw_texture_target_; | 54 unsigned draw_texture_target_; |
| 54 RasterBufferProviderType raster_buffer_provider_type_; | 55 RasterBufferProviderType raster_buffer_provider_type_; |
| 55 ResourceProvider::TextureHint texture_hint_; | 56 ResourceProvider::TextureHint texture_hint_; |
| 57 Layer::LayerMaskType mask_type_; |
| 56 bool initialized_; | 58 bool initialized_; |
| 57 | 59 |
| 58 void InitializeFromTestCase(PixelResourceTestCase test_case); | 60 void InitializeFromTestCase(PixelResourceTestCase test_case); |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 PixelResourceTestCase test_case_; | 63 PixelResourceTestCase test_case_; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 #define INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(framework_name) \ | 66 #define INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(framework_name) \ |
| 65 INSTANTIATE_TEST_CASE_P( \ | 67 INSTANTIATE_TEST_CASE_P( \ |
| 66 PixelResourceTest, framework_name, \ | 68 PixelResourceTest, framework_name, \ |
| 67 ::testing::Values( \ | 69 ::testing::Combine( \ |
| 68 SOFTWARE, GL_GPU_RASTER_2D_DRAW, GL_ONE_COPY_2D_STAGING_2D_DRAW, \ | 70 ::testing::Values( \ |
| 69 GL_ONE_COPY_RECT_STAGING_2D_DRAW, \ | 71 SOFTWARE, GL_GPU_RASTER_2D_DRAW, GL_ONE_COPY_2D_STAGING_2D_DRAW, \ |
| 70 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, GL_ZERO_COPY_2D_DRAW, \ | 72 GL_ONE_COPY_RECT_STAGING_2D_DRAW, \ |
| 71 GL_ZERO_COPY_RECT_DRAW, GL_ZERO_COPY_EXTERNAL_DRAW)) | 73 GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, GL_ZERO_COPY_2D_DRAW, \ |
| 74 GL_ZERO_COPY_RECT_DRAW, GL_ZERO_COPY_EXTERNAL_DRAW), \ |
| 75 ::testing::Values(Layer::LayerMaskType::SINGLE_TEXTURE_MASK, \ |
| 76 Layer::LayerMaskType::MULTI_TEXTURE_MASK))) |
| 72 | 77 |
| 73 class ParameterizedPixelResourceTest | 78 class ParameterizedPixelResourceTest |
| 74 : public LayerTreeHostPixelResourceTest, | 79 : public LayerTreeHostPixelResourceTest, |
| 75 public ::testing::WithParamInterface<PixelResourceTestCase> { | 80 public ::testing::WithParamInterface< |
| 81 ::testing::tuple<PixelResourceTestCase, Layer::LayerMaskType>> { |
| 76 public: | 82 public: |
| 77 ParameterizedPixelResourceTest(); | 83 ParameterizedPixelResourceTest(); |
| 78 }; | 84 }; |
| 79 | 85 |
| 80 } // namespace cc | 86 } // namespace cc |
| 81 | 87 |
| 82 #endif // CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ | 88 #endif // CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ |
| OLD | NEW |