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 #include "cc/surfaces/surface_aggregator_test_helpers.h" | 5 #include "cc/surfaces/surface_aggregator_test_helpers.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 switch (expected_quad.material) { | 110 switch (expected_quad.material) { |
111 case DrawQuad::SOLID_COLOR: { | 111 case DrawQuad::SOLID_COLOR: { |
112 ASSERT_EQ(DrawQuad::SOLID_COLOR, quad->material); | 112 ASSERT_EQ(DrawQuad::SOLID_COLOR, quad->material); |
113 | 113 |
114 const SolidColorDrawQuad* solid_color_quad = | 114 const SolidColorDrawQuad* solid_color_quad = |
115 SolidColorDrawQuad::MaterialCast(quad); | 115 SolidColorDrawQuad::MaterialCast(quad); |
116 | 116 |
117 EXPECT_EQ(expected_quad.color, solid_color_quad->color); | 117 EXPECT_EQ(expected_quad.color, solid_color_quad->color); |
118 break; | 118 break; |
119 } | 119 } |
| 120 case DrawQuad::RENDER_PASS: { |
| 121 ASSERT_EQ(DrawQuad::RENDER_PASS, quad->material); |
| 122 |
| 123 const RenderPassDrawQuad* render_pass_quad = |
| 124 RenderPassDrawQuad::MaterialCast(quad); |
| 125 |
| 126 EXPECT_EQ(expected_quad.render_pass_id, render_pass_quad->render_pass_id); |
| 127 break; |
| 128 } |
120 default: | 129 default: |
121 NOTREACHED(); | 130 NOTREACHED(); |
122 break; | 131 break; |
123 } | 132 } |
124 } | 133 } |
125 | 134 |
126 void TestPassMatchesExpectations(Pass expected_pass, RenderPass* pass) { | 135 void TestPassMatchesExpectations(Pass expected_pass, RenderPass* pass) { |
127 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size()); | 136 ASSERT_EQ(expected_pass.quad_count, pass->quad_list.size()); |
128 for (size_t i = 0u; i < pass->quad_list.size(); ++i) { | 137 for (size_t i = 0u; i < pass->quad_list.size(); ++i) { |
129 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i)); | 138 SCOPED_TRACE(base::StringPrintf("Quad number %" PRIuS, i)); |
130 TestQuadMatchesExpectations(expected_pass.quads[i], pass->quad_list.at(i)); | 139 TestQuadMatchesExpectations(expected_pass.quads[i], pass->quad_list.at(i)); |
131 } | 140 } |
132 } | 141 } |
133 | 142 |
134 void TestPassesMatchExpectations(Pass* expected_passes, | 143 void TestPassesMatchExpectations(Pass* expected_passes, |
135 size_t expected_pass_count, | 144 size_t expected_pass_count, |
136 RenderPassList* passes) { | 145 RenderPassList* passes) { |
137 ASSERT_EQ(expected_pass_count, passes->size()); | 146 ASSERT_EQ(expected_pass_count, passes->size()); |
138 | 147 |
139 for (size_t i = 0; i < passes->size(); ++i) { | 148 for (size_t i = 0; i < passes->size(); ++i) { |
140 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i)); | 149 SCOPED_TRACE(base::StringPrintf("Pass number %" PRIuS, i)); |
141 RenderPass* pass = passes->at(i); | 150 RenderPass* pass = passes->at(i); |
142 TestPassMatchesExpectations(expected_passes[i], pass); | 151 TestPassMatchesExpectations(expected_passes[i], pass); |
143 } | 152 } |
144 } | 153 } |
145 | 154 |
146 } // namespace test | 155 } // namespace test |
147 } // namespace cc | 156 } // namespace cc |
OLD | NEW |