Index: cc/test/layer_tree_pixel_resource_test.h |
diff --git a/cc/test/layer_tree_pixel_resource_test.h b/cc/test/layer_tree_pixel_resource_test.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d969de12b04748a11a1c7747b0c07a1110469069 |
--- /dev/null |
+++ b/cc/test/layer_tree_pixel_resource_test.h |
@@ -0,0 +1,87 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ |
+#define CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "cc/test/layer_tree_pixel_test.h" |
+ |
+namespace cc { |
+ |
+class LayerTreeHostImpl; |
+class RasterWorkerPool; |
+class ResourcePool; |
+ |
+// Enumerate the various combinations of renderer, resource pool, staging |
+// texture type, and drawing texture types. Not all of the combinations |
+// are possible (or worth testing independently), so this is the minimal |
+// list to hit all codepaths. |
+enum PixelResourceTestCase { |
+ SOFTWARE, |
+ GL_GPU_RASTER_2D_DRAW, |
+ GL_ONE_COPY_2D_STAGING_2D_DRAW, |
+ GL_ONE_COPY_RECT_STAGING_2D_DRAW, |
+ GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, |
+ GL_ZERO_COPY_2D_DRAW, |
+ GL_ZERO_COPY_RECT_DRAW, |
+ GL_ZERO_COPY_EXTERNAL_DRAW, |
+ GL_ASYNC_UPLOAD_2D_DRAW, |
reveman
2014/10/23 20:39:27
What's the naming convention here?
GL_(raster-wor
enne (OOO)
2014/10/24 22:21:28
Don't agree. See comment below.
|
+ NUM_PIXEL_RESOURCE_TEST_CASES, |
reveman
2014/10/23 20:39:27
If you're going to keep this then consider using "
enne (OOO)
2014/10/24 22:21:28
Removed.
|
+}; |
+ |
+class LayerTreeHostPixelResourceTest : public LayerTreePixelTest { |
+ public: |
+ explicit LayerTreeHostPixelResourceTest(PixelResourceTestCase test_case); |
+ |
+ void CreateResourceAndRasterWorkerPool( |
+ LayerTreeHostImpl* host_impl, |
+ scoped_ptr<RasterWorkerPool>* raster_worker_pool, |
+ scoped_ptr<ResourcePool>* resource_pool, |
+ scoped_ptr<ResourcePool>* staging_resource_pool) override; |
+ |
+ void RunPixelResourceTest(scoped_refptr<Layer> content_root, |
+ base::FilePath file_name); |
+ |
+ enum ResourcePoolOption { |
reveman
2014/10/23 20:39:27
ResourcePoolOption, uh? Should it be RasterizeOpti
enne (OOO)
2014/10/24 22:21:28
Sure.
|
+ RESOURCE_POOL_BITMAP_RASTER_WORKER, |
+ RESOURCE_POOL_GPU_RASTER, |
+ RESOURCE_POOL_ZERO_COPY, |
+ RESOURCE_POOL_ONE_COPY, |
+ RESOURCE_POOL_PIXEL_BUFFER_RASTER, |
reveman
2014/10/23 20:39:27
Can you make these names better align with RasterW
enne (OOO)
2014/10/24 22:21:28
I named them identically to the class names, e.g.
|
+ }; |
+ |
+ protected: |
+ unsigned staging_texture_target_; |
+ unsigned draw_texture_target_; |
reveman
2014/10/23 20:39:27
I don't think we should have both staging and draw
enne (OOO)
2014/10/24 22:21:28
I disagree. raster_texture_target just hides the
reveman
2014/10/27 17:19:04
To pixel test draw target support independent of a
enne (OOO)
2014/10/27 17:56:22
Maybe you should have mentioned that several revie
reveman
2014/10/27 18:42:44
Testing all supported draw targets sgtm. Testing a
|
+ ResourcePoolOption resource_pool_option_; |
+ |
+ private: |
+ PixelResourceTestCase test_case_; |
+}; |
+ |
+#define INSTANTIATE_PIXEL_RESOURCE_TEST_CASE_P(framework_name) \ |
+ INSTANTIATE_TEST_CASE_P( \ |
+ PixelResourceTest, \ |
+ framework_name, \ |
+ ::testing::Values(SOFTWARE, \ |
+ GL_GPU_RASTER_2D_DRAW, \ |
+ GL_ONE_COPY_2D_STAGING_2D_DRAW, \ |
+ GL_ONE_COPY_RECT_STAGING_2D_DRAW, \ |
+ GL_ONE_COPY_EXTERNAL_STAGING_2D_DRAW, \ |
+ GL_ZERO_COPY_2D_DRAW, \ |
+ GL_ZERO_COPY_RECT_DRAW, \ |
+ GL_ZERO_COPY_EXTERNAL_DRAW, \ |
+ GL_ASYNC_UPLOAD_2D_DRAW)) |
+ |
+class ParameterizedPixelResourceTest |
+ : public LayerTreeHostPixelResourceTest, |
+ public ::testing::WithParamInterface<PixelResourceTestCase> { |
+ public: |
+ ParameterizedPixelResourceTest(); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_TEST_LAYER_TREE_PIXEL_RESOURCE_TEST_H_ |