Coalesce / extract ContextState initialization expectations
The expectations for the initialization of ContextState are duplicated
between GLES2DecoderTestBase and RasterDecoderTestBase. Extract them
into a separate helper class.
Bug: None
Change-Id: Ib7d9b1e08a759af7a2bd199c33ce61f971ea7b88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1663323
Auto-Submit: Antoine Labour <piman@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670192}
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index 3053b53b..de22b07 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -446,6 +446,9 @@
"command_buffer/service/command_buffer_service_unittest.cc",
"command_buffer/service/common_decoder_unittest.cc",
"command_buffer/service/context_group_unittest.cc",
+ "command_buffer/service/context_state_test_helpers.cc",
+ "command_buffer/service/context_state_test_helpers.h",
+ "command_buffer/service/context_state_test_helpers_autogen.h",
"command_buffer/service/context_state_unittest.cc",
"command_buffer/service/feature_info_unittest.cc",
"command_buffer/service/framebuffer_manager_unittest.cc",
@@ -458,7 +461,6 @@
"command_buffer/service/gl_surface_mock.h",
"command_buffer/service/gles2_cmd_decoder_unittest.cc",
"command_buffer/service/gles2_cmd_decoder_unittest.h",
- "command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h",
"command_buffer/service/gles2_cmd_decoder_unittest_1.cc",
"command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h",
"command_buffer/service/gles2_cmd_decoder_unittest_2.cc",
diff --git a/gpu/command_buffer/build_cmd_buffer_lib.py b/gpu/command_buffer/build_cmd_buffer_lib.py
index 9d66d12..6590b51 100644
--- a/gpu/command_buffer/build_cmd_buffer_lib.py
+++ b/gpu/command_buffer/build_cmd_buffer_lib.py
@@ -576,25 +576,23 @@
'name': 'scissor_x',
'type': 'GLint',
'default': '0',
- 'expected': 'kViewportX',
},
{
'name': 'scissor_y',
'type': 'GLint',
'default': '0',
- 'expected': 'kViewportY',
},
{
'name': 'scissor_width',
'type': 'GLsizei',
'default': '1',
- 'expected': 'kViewportWidth',
+ 'expected': 'initial_size.width()',
},
{
'name': 'scissor_height',
'type': 'GLsizei',
'default': '1',
- 'expected': 'kViewportHeight',
+ 'expected': 'initial_size.height()',
},
],
},
@@ -608,25 +606,23 @@
'name': 'viewport_x',
'type': 'GLint',
'default': '0',
- 'expected': 'kViewportX',
},
{
'name': 'viewport_y',
'type': 'GLint',
'default': '0',
- 'expected': 'kViewportY',
},
{
'name': 'viewport_width',
'type': 'GLsizei',
'default': '1',
- 'expected': 'kViewportWidth',
+ 'expected': 'initial_size.width()',
},
{
'name': 'viewport_height',
'type': 'GLsizei',
'default': '1',
- 'expected': 'kViewportHeight',
+ 'expected': 'initial_size.height()',
},
],
},
@@ -780,7 +776,7 @@
return 'cached_' + item['name']
return item['name']
-def GuardState(state, operation):
+def GuardState(state, operation, feature_info):
if 'manual' in state:
assert state['manual']
return ""
@@ -789,11 +785,11 @@
result_end = []
if 'es3' in state:
assert state['es3']
- result.append(" if (feature_info_->IsES3Capable()) {\n");
+ result.append(" if (%s->IsES3Capable()) {\n" % feature_info);
result_end.append(" }\n")
if 'extension_flag' in state:
- result.append(" if (feature_info_->feature_flags().%s) {\n " %
- (state['extension_flag']))
+ result.append(" if (%s->feature_flags().%s) {\n " %
+ (feature_info, state['extension_flag']))
result_end.append(" }\n")
if 'gl_version_flag' in state:
name = state['gl_version_flag']
@@ -801,8 +797,8 @@
if name[0] == '!':
inverted = '!'
name = name[1:]
- result.append(" if (%sfeature_info_->gl_version_info().%s) {\n" %
- (inverted, name))
+ result.append(" if (%s%s->gl_version_info().%s) {\n" %
+ (inverted, feature_info, name))
result_end.append(" }\n")
result.append(operation)
@@ -1868,7 +1864,7 @@
if not func.GetInfo("no_gl"):
operation = " %s(%s);\n" % \
(func.GetGLFunctionName(), func.MakeOriginalArgString(""))
- f.write(GuardState(state, operation))
+ f.write(GuardState(state, operation, "feature_info_"))
f.write(" }\n")
f.write(" break;\n")
f.write(" default:\n")
@@ -6800,7 +6796,8 @@
if test_prev:
operation.append(" }")
- guarded_operation = GuardState(item, ''.join(operation))
+ guarded_operation = GuardState(item, ''.join(operation),
+ "feature_info_")
f.write(guarded_operation)
else:
if 'extension_flag' in state:
@@ -6998,14 +6995,16 @@
})
self.generated_cpp_filenames.append(filename)
- comment = ("// It is included by %s_cmd_decoder_unittest_base.cc\n"
- % _lower_prefix)
- filename = filename_pattern % 0
+
+ def WriteServiceContextStateTestHelpers(self, filename):
+ comment = "// It is included by context_state_test_helpers.cc\n"
with CHeaderWriter(filename, self.year, comment) as f:
if self.capability_flags:
f.write(
-"""void %sDecoderTestBase::SetupInitCapabilitiesExpectations(
- bool es3_capable) {""" % _prefix)
+ """void ContextStateTestHelpers::SetupInitCapabilitiesExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info) {
+""")
for capability in self.capability_flags:
capability_no_init = 'no_init' in capability and \
capability['no_init'] == True
@@ -7015,28 +7014,30 @@
if capability_es3:
continue
if 'extension_flag' in capability:
- f.write(" if (feature_info()->feature_flags().%s) {\n" %
+ f.write(" if (feature_info->feature_flags().%s) {\n" %
capability['extension_flag'])
f.write(" ")
- f.write(" ExpectEnableDisable(GL_%s, %s);\n" %
+ f.write(" ExpectEnableDisable(gl, GL_%s, %s);\n" %
(capability['name'].upper(),
('false', 'true')['default' in capability]))
if 'extension_flag' in capability:
f.write(" }")
- f.write(" if (es3_capable) {")
+ f.write(" if (feature_info->IsES3Capable()) {")
for capability in self.capability_flags:
capability_es3 = 'es3' in capability and capability['es3'] == True
if capability_es3:
- f.write(" ExpectEnableDisable(GL_%s, %s);\n" %
+ f.write(" ExpectEnableDisable(gl, GL_%s, %s);\n" %
(capability['name'].upper(),
('false', 'true')['default' in capability]))
f.write(""" }
}
""")
f.write("""
-void %sDecoderTestBase::SetupInitStateExpectations(bool es3_capable) {
- auto* feature_info_ = feature_info();
-""" % _prefix)
+void ContextStateTestHelpers::SetupInitStateExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info,
+ const gfx::Size& initial_size) {
+""")
# We need to sort the keys so the expectations match
for state_name in sorted(_STATE_INFO.keys()):
state = _STATE_INFO[state_name]
@@ -7051,7 +7052,7 @@
else:
args.append(item['default'])
f.write(
- " EXPECT_CALL(*gl_, %s(%s, %s))\n" %
+ " EXPECT_CALL(*gl, %s(%s, %s))\n" %
(state['func'], ('GL_FRONT', 'GL_BACK')[ndx],
", ".join(args)))
f.write(" .Times(1)\n")
@@ -7065,7 +7066,7 @@
operation = []
operation.append(
- " EXPECT_CALL(*gl_, %s(%s, %s))\n" %
+ " EXPECT_CALL(*gl, %s(%s, %s))\n" %
(state['func'],
(item['enum_set']
if 'enum_set' in item else item['enum']),
@@ -7073,11 +7074,12 @@
operation.append(" .Times(1)\n")
operation.append(" .RetiresOnSaturation();\n")
- guarded_operation = GuardState(item, ''.join(operation))
+ guarded_operation = GuardState(item, ''.join(operation),
+ "feature_info")
f.write(guarded_operation)
elif 'no_init' not in state:
if 'extension_flag' in state:
- f.write(" if (feature_info()->feature_flags().%s) {\n" %
+ f.write(" if (feature_info->feature_flags().%s) {\n" %
state['extension_flag'])
f.write(" ")
args = []
@@ -7089,16 +7091,16 @@
# TODO: Currently we do not check array values.
args = ["_" if isinstance(arg, list) else arg for arg in args]
if 'custom_function' in state:
- f.write(" SetupInitStateManualExpectationsFor%s(%s);\n" %
+ f.write(" SetupInitStateManualExpectationsFor%s(gl, %s);\n" %
(state['func'], ", ".join(args)))
else:
- f.write(" EXPECT_CALL(*gl_, %s(%s))\n" %
+ f.write(" EXPECT_CALL(*gl, %s(%s))\n" %
(state['func'], ", ".join(args)))
f.write(" .Times(1)\n")
f.write(" .RetiresOnSaturation();\n")
if 'extension_flag' in state:
f.write(" }\n")
- f.write(" SetupInitStateManualExpectations(es3_capable);\n")
+ f.write(" SetupInitStateManualExpectations(gl, feature_info);\n")
f.write("}\n")
self.generated_cpp_filenames.append(filename)
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 4a4fb94..38ffa4c 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -4414,6 +4414,8 @@
"gpu/command_buffer/service/context_state_autogen.h")
gen.WriteServiceContextStateImpl(
"gpu/command_buffer/service/context_state_impl_autogen.h")
+ gen.WriteServiceContextStateTestHelpers(
+ "gpu/command_buffer/service/context_state_test_helpers_autogen.h")
gen.WriteClientContextStateHeader(
"gpu/command_buffer/client/client_context_state_autogen.h")
gen.WriteClientContextStateImpl(
diff --git a/gpu/command_buffer/service/context_state_test_helpers.cc b/gpu/command_buffer/service/context_state_test_helpers.cc
new file mode 100644
index 0000000..70e7ac19
--- /dev/null
+++ b/gpu/command_buffer/service/context_state_test_helpers.cc
@@ -0,0 +1,63 @@
+// Copyright 2019 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.
+
+#include "gpu/command_buffer/service/context_state_test_helpers.h"
+
+#include "gpu/command_buffer/service/feature_info.h"
+#include "ui/gfx/geometry/size.h"
+#include "ui/gl/gl_version_info.h"
+
+using ::testing::_;
+
+namespace gpu {
+// Include the auto-generated part of this file. We split this because it means
+// we can easily edit the non-auto generated parts right here in this file
+// instead of having to edit some template or the code generator.
+#include "gpu/command_buffer/service/context_state_test_helpers_autogen.h"
+
+void ContextStateTestHelpers::SetupInitState(MockGL* gl,
+ gles2::FeatureInfo* feature_info,
+ const gfx::Size& initial_size) {
+ SetupInitCapabilitiesExpectations(gl, feature_info);
+ SetupInitStateExpectations(gl, feature_info, initial_size);
+}
+
+void ContextStateTestHelpers::SetupInitStateManualExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info) {
+ if (feature_info->IsES3Capable()) {
+ EXPECT_CALL(*gl, PixelStorei(GL_PACK_ROW_LENGTH, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, PixelStorei(GL_UNPACK_ROW_LENGTH, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ if (feature_info->feature_flags().ext_window_rectangles) {
+ EXPECT_CALL(*gl, WindowRectanglesEXT(GL_EXCLUSIVE_EXT, 0, nullptr))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ }
+}
+
+void ContextStateTestHelpers::SetupInitStateManualExpectationsForDoLineWidth(
+ MockGL* gl,
+ GLfloat width) {
+ EXPECT_CALL(*gl, LineWidth(width)).Times(1).RetiresOnSaturation();
+}
+
+void ContextStateTestHelpers::ExpectEnableDisable(MockGL* gl,
+ GLenum cap,
+ bool enable) {
+ if (enable) {
+ EXPECT_CALL(*gl, Enable(cap)).Times(1).RetiresOnSaturation();
+ } else {
+ EXPECT_CALL(*gl, Disable(cap)).Times(1).RetiresOnSaturation();
+ }
+}
+
+} // namespace gpu
diff --git a/gpu/command_buffer/service/context_state_test_helpers.h b/gpu/command_buffer/service/context_state_test_helpers.h
new file mode 100644
index 0000000..4ee751c
--- /dev/null
+++ b/gpu/command_buffer/service/context_state_test_helpers.h
@@ -0,0 +1,44 @@
+// Copyright 2019 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 GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_H_
+#define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_H_
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_mock.h"
+
+namespace gfx {
+class Size;
+} // namespace gfx
+
+namespace gpu {
+namespace gles2 {
+class FeatureInfo;
+} // namespace gles2
+
+class ContextStateTestHelpers {
+ public:
+ using MockGL = ::testing::StrictMock<::gl::MockGLInterface>;
+ static void SetupInitState(MockGL* gl,
+ gles2::FeatureInfo* feature_info,
+ const gfx::Size& initial_size);
+
+ private:
+ static void SetupInitCapabilitiesExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info);
+ static void SetupInitStateExpectations(MockGL* gl,
+ gles2::FeatureInfo* feature_info,
+ const gfx::Size& initial_size);
+ static void SetupInitStateManualExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info);
+ static void SetupInitStateManualExpectationsForDoLineWidth(MockGL* gl,
+ GLfloat width);
+ static void ExpectEnableDisable(MockGL* gl, GLenum cap, bool enable);
+};
+
+} // namespace gpu
+
+#endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_H_
diff --git a/gpu/command_buffer/service/context_state_test_helpers_autogen.h b/gpu/command_buffer/service/context_state_test_helpers_autogen.h
new file mode 100644
index 0000000..6fa1c493
--- /dev/null
+++ b/gpu/command_buffer/service/context_state_test_helpers_autogen.h
@@ -0,0 +1,135 @@
+// 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.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+// It is included by context_state_test_helpers.cc
+#ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_AUTOGEN_H_
+#define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_AUTOGEN_H_
+
+void ContextStateTestHelpers::SetupInitCapabilitiesExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info) {
+ ExpectEnableDisable(gl, GL_BLEND, false);
+ ExpectEnableDisable(gl, GL_CULL_FACE, false);
+ ExpectEnableDisable(gl, GL_DEPTH_TEST, false);
+ ExpectEnableDisable(gl, GL_DITHER, true);
+ ExpectEnableDisable(gl, GL_POLYGON_OFFSET_FILL, false);
+ ExpectEnableDisable(gl, GL_SAMPLE_ALPHA_TO_COVERAGE, false);
+ ExpectEnableDisable(gl, GL_SAMPLE_COVERAGE, false);
+ ExpectEnableDisable(gl, GL_SCISSOR_TEST, false);
+ ExpectEnableDisable(gl, GL_STENCIL_TEST, false);
+ if (feature_info->feature_flags().ext_multisample_compatibility) {
+ ExpectEnableDisable(gl, GL_MULTISAMPLE_EXT, true);
+ }
+ if (feature_info->feature_flags().ext_multisample_compatibility) {
+ ExpectEnableDisable(gl, GL_SAMPLE_ALPHA_TO_ONE_EXT, false);
+ }
+ if (feature_info->IsES3Capable()) {
+ ExpectEnableDisable(gl, GL_RASTERIZER_DISCARD, false);
+ ExpectEnableDisable(gl, GL_PRIMITIVE_RESTART_FIXED_INDEX, false);
+ }
+}
+
+void ContextStateTestHelpers::SetupInitStateExpectations(
+ MockGL* gl,
+ gles2::FeatureInfo* feature_info,
+ const gfx::Size& initial_size) {
+ EXPECT_CALL(*gl, BlendColor(0.0f, 0.0f, 0.0f, 0.0f))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, BlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, BlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, ClearColor(0.0f, 0.0f, 0.0f, 0.0f))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, ClearDepth(1.0f)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, ClearStencil(0)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, ColorMask(true, true, true, true))
+ .Times(1)
+ .RetiresOnSaturation();
+ if (feature_info->feature_flags().chromium_framebuffer_mixed_samples) {
+ EXPECT_CALL(*gl, CoverageModulationNV(GL_NONE))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ EXPECT_CALL(*gl, CullFace(GL_BACK)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, DepthFunc(GL_LESS)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, DepthMask(true)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, DepthRange(0.0f, 1.0f)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, FrontFace(GL_CCW)).Times(1).RetiresOnSaturation();
+ if (!feature_info->gl_version_info().is_desktop_core_profile) {
+ EXPECT_CALL(*gl, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ if (feature_info->feature_flags().oes_standard_derivatives) {
+ EXPECT_CALL(*gl, Hint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, GL_DONT_CARE))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ if (feature_info->feature_flags().chromium_texture_filtering_hint) {
+ EXPECT_CALL(*gl, Hint(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ SetupInitStateManualExpectationsForDoLineWidth(gl, 1.0f);
+ if (feature_info->feature_flags().chromium_path_rendering) {
+ EXPECT_CALL(*gl, MatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ if (feature_info->feature_flags().chromium_path_rendering) {
+ EXPECT_CALL(*gl, MatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, _))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ if (feature_info->feature_flags().chromium_path_rendering) {
+ EXPECT_CALL(*gl, PathStencilFuncNV(GL_ALWAYS, 0, 0xFFFFFFFFU))
+ .Times(1)
+ .RetiresOnSaturation();
+ }
+ EXPECT_CALL(*gl, PixelStorei(GL_PACK_ALIGNMENT, 4))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, PixelStorei(GL_UNPACK_ALIGNMENT, 4))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, PolygonOffset(0.0f, 0.0f)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, SampleCoverage(1.0f, false)).Times(1).RetiresOnSaturation();
+ EXPECT_CALL(*gl, Scissor(0, 0, initial_size.width(), initial_size.height()))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, 0xFFFFFFFFU))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFFU))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilMaskSeparate(GL_FRONT, 0xFFFFFFFFU))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilMaskSeparate(GL_BACK, 0xFFFFFFFFU))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, StencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl, Viewport(0, 0, initial_size.width(), initial_size.height()))
+ .Times(1)
+ .RetiresOnSaturation();
+ SetupInitStateManualExpectations(gl, feature_info);
+}
+#endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_STATE_TEST_HELPERS_AUTOGEN_H_
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h
deleted file mode 100644
index 09a217d1..0000000
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// 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.
-
-// This file is auto-generated from
-// gpu/command_buffer/build_gles2_cmd_buffer.py
-// It's formatted by clang-format using chromium coding style:
-// clang-format -i -style=chromium filename
-// DO NOT EDIT!
-
-// It is included by gles2_cmd_decoder_unittest_base.cc
-#ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_0_AUTOGEN_H_
-#define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_0_AUTOGEN_H_
-
-void GLES2DecoderTestBase::SetupInitCapabilitiesExpectations(bool es3_capable) {
- ExpectEnableDisable(GL_BLEND, false);
- ExpectEnableDisable(GL_CULL_FACE, false);
- ExpectEnableDisable(GL_DEPTH_TEST, false);
- ExpectEnableDisable(GL_DITHER, true);
- ExpectEnableDisable(GL_POLYGON_OFFSET_FILL, false);
- ExpectEnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE, false);
- ExpectEnableDisable(GL_SAMPLE_COVERAGE, false);
- ExpectEnableDisable(GL_SCISSOR_TEST, false);
- ExpectEnableDisable(GL_STENCIL_TEST, false);
- if (feature_info()->feature_flags().ext_multisample_compatibility) {
- ExpectEnableDisable(GL_MULTISAMPLE_EXT, true);
- }
- if (feature_info()->feature_flags().ext_multisample_compatibility) {
- ExpectEnableDisable(GL_SAMPLE_ALPHA_TO_ONE_EXT, false);
- }
- if (es3_capable) {
- ExpectEnableDisable(GL_RASTERIZER_DISCARD, false);
- ExpectEnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX, false);
- }
-}
-
-void GLES2DecoderTestBase::SetupInitStateExpectations(bool es3_capable) {
- auto* feature_info_ = feature_info();
- EXPECT_CALL(*gl_, BlendColor(0.0f, 0.0f, 0.0f, 0.0f))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, BlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, BlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearDepth(1.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearStencil(0)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, ColorMask(true, true, true, true))
- .Times(1)
- .RetiresOnSaturation();
- if (feature_info()->feature_flags().chromium_framebuffer_mixed_samples) {
- EXPECT_CALL(*gl_, CoverageModulationNV(GL_NONE))
- .Times(1)
- .RetiresOnSaturation();
- }
- EXPECT_CALL(*gl_, CullFace(GL_BACK)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthFunc(GL_LESS)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthMask(true)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthRange(0.0f, 1.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, FrontFace(GL_CCW)).Times(1).RetiresOnSaturation();
- if (!feature_info_->gl_version_info().is_desktop_core_profile) {
- EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().oes_standard_derivatives) {
- EXPECT_CALL(*gl_,
- Hint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, GL_DONT_CARE))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().chromium_texture_filtering_hint) {
- EXPECT_CALL(*gl_, Hint(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST))
- .Times(1)
- .RetiresOnSaturation();
- }
- SetupInitStateManualExpectationsForDoLineWidth(1.0f);
- if (feature_info_->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, MatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, _))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, MatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, _))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info()->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, PathStencilFuncNV(GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- }
- EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PolygonOffset(0.0f, 0.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, SampleCoverage(1.0f, false)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_,
- Scissor(kViewportX, kViewportY, kViewportWidth, kViewportHeight))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_,
- Viewport(kViewportX, kViewportY, kViewportWidth, kViewportHeight))
- .Times(1)
- .RetiresOnSaturation();
- SetupInitStateManualExpectations(es3_capable);
-}
-#endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_0_AUTOGEN_H_
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index 34bfa245..222b2d42 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -19,6 +19,7 @@
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/context_state_test_helpers.h"
#include "gpu/command_buffer/service/copy_texture_chromium_mock.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/logger.h"
@@ -438,8 +439,9 @@
.RetiresOnSaturation();
}
- SetupInitCapabilitiesExpectations(group_->feature_info()->IsES3Capable());
- SetupInitStateExpectations(group_->feature_info()->IsES3Capable());
+ ContextStateTestHelpers::SetupInitState(
+ gl_.get(), group_->feature_info(),
+ gfx::Size(kBackBufferWidth, kBackBufferHeight));
EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0))
.Times(1)
@@ -616,19 +618,6 @@
ResetDecoder();
}
-void GLES2DecoderTestBase::ExpectEnableDisable(GLenum cap, bool enable) {
- if (enable) {
- EXPECT_CALL(*gl_, Enable(cap))
- .Times(1)
- .RetiresOnSaturation();
- } else {
- EXPECT_CALL(*gl_, Disable(cap))
- .Times(1)
- .RetiresOnSaturation();
- }
-}
-
-
GLint GLES2DecoderTestBase::GetGLError() {
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -1799,11 +1788,6 @@
const GLint GLES2DecoderTestBase::kMaxViewportWidth;
const GLint GLES2DecoderTestBase::kMaxViewportHeight;
-const GLint GLES2DecoderTestBase::kViewportX;
-const GLint GLES2DecoderTestBase::kViewportY;
-const GLint GLES2DecoderTestBase::kViewportWidth;
-const GLint GLES2DecoderTestBase::kViewportHeight;
-
const GLuint GLES2DecoderTestBase::kServiceAttrib0BufferId;
const GLuint GLES2DecoderTestBase::kServiceFixedAttribBufferId;
@@ -2361,30 +2345,6 @@
&GLES2DecoderTestBase::MockGLStates::OnVertexAttribNullPointer));
}
-void GLES2DecoderTestBase::SetupInitStateManualExpectations(bool es3_capable) {
- if (es3_capable) {
- EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ROW_LENGTH, 0))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ROW_LENGTH, 0))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0))
- .Times(1)
- .RetiresOnSaturation();
- if (group_->feature_info()->feature_flags().ext_window_rectangles) {
- EXPECT_CALL(*gl_, WindowRectanglesEXT(GL_EXCLUSIVE_EXT, 0, nullptr))
- .Times(1)
- .RetiresOnSaturation();
- }
- }
-}
-
-void GLES2DecoderTestBase::SetupInitStateManualExpectationsForDoLineWidth(
- GLfloat width) {
- EXPECT_CALL(*gl_, LineWidth(width)).Times(1).RetiresOnSaturation();
-}
-
void GLES2DecoderWithShaderTestBase::SetUp() {
GLES2DecoderTestBase::SetUp();
SetupDefaultProgram();
@@ -2414,11 +2374,6 @@
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
}
-// Include the auto-generated part of this file. We split this because it means
-// we can easily edit the non-auto generated parts right here in this file
-// instead of having to edit some template or the code generator.
-#include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
-
namespace {
GpuPreferences GenerateGpuPreferencesForPassthroughTests() {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
index 4b9e783..9bfb9e6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
@@ -273,10 +273,6 @@
GLuint vertex_shader_client_id, GLuint vertex_shader_service_id,
GLuint fragment_shader_client_id, GLuint fragment_shader_service_id);
- void SetupInitCapabilitiesExpectations(bool es3_capable);
- void SetupInitStateExpectations(bool es3_capable);
- void ExpectEnableDisable(GLenum cap, bool enable);
-
// Setups up a shader for testing glUniform.
void SetupShaderForUniform(GLenum uniform_type);
void SetupDefaultProgram();
@@ -561,11 +557,6 @@
static const GLint kMaxViewportWidth = 8192;
static const GLint kMaxViewportHeight = 8192;
- static const GLint kViewportX = 0;
- static const GLint kViewportY = 0;
- static const GLint kViewportWidth = kBackBufferWidth;
- static const GLint kViewportHeight = kBackBufferHeight;
-
static const GLuint kServiceAttrib0BufferId = 801;
static const GLuint kServiceFixedAttribBufferId = 802;
@@ -799,11 +790,6 @@
void AddExpectationsForVertexAttribManager();
void SetupMockGLBehaviors();
- void SetupInitStateManualExpectations(bool es3_capable);
- void SetupInitStateManualExpectationsForWindowRectanglesEXT(GLenum mode,
- GLint count);
- void SetupInitStateManualExpectationsForDoLineWidth(GLfloat width);
-
GpuPreferences gpu_preferences_;
MailboxManagerImpl mailbox_manager_;
ShaderTranslatorCache shader_translator_cache_;
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_0_autogen.h b/gpu/command_buffer/service/raster_decoder_unittest_0_autogen.h
deleted file mode 100644
index 200cbb5..0000000
--- a/gpu/command_buffer/service/raster_decoder_unittest_0_autogen.h
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2018 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.
-
-// This file is auto-generated from
-// gpu/command_buffer/build_raster_cmd_buffer.py
-// It's formatted by clang-format using chromium coding style:
-// clang-format -i -style=chromium filename
-// DO NOT EDIT!
-
-// It is included by raster_cmd_decoder_unittest_base.cc
-#ifndef GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_UNITTEST_0_AUTOGEN_H_
-#define GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_UNITTEST_0_AUTOGEN_H_
-
-void RasterDecoderTestBase::SetupInitCapabilitiesExpectations(
- bool es3_capable) {
- ExpectEnableDisable(GL_BLEND, false);
- ExpectEnableDisable(GL_CULL_FACE, false);
- ExpectEnableDisable(GL_DEPTH_TEST, false);
- ExpectEnableDisable(GL_DITHER, true);
- ExpectEnableDisable(GL_POLYGON_OFFSET_FILL, false);
- ExpectEnableDisable(GL_SAMPLE_ALPHA_TO_COVERAGE, false);
- ExpectEnableDisable(GL_SAMPLE_COVERAGE, false);
- ExpectEnableDisable(GL_SCISSOR_TEST, false);
- ExpectEnableDisable(GL_STENCIL_TEST, false);
- if (feature_info()->feature_flags().ext_multisample_compatibility) {
- ExpectEnableDisable(GL_MULTISAMPLE_EXT, true);
- }
- if (feature_info()->feature_flags().ext_multisample_compatibility) {
- ExpectEnableDisable(GL_SAMPLE_ALPHA_TO_ONE_EXT, false);
- }
- if (es3_capable) {
- ExpectEnableDisable(GL_RASTERIZER_DISCARD, false);
- ExpectEnableDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX, false);
- }
-}
-
-void RasterDecoderTestBase::SetupInitStateExpectations(bool es3_capable) {
- auto* feature_info_ = feature_info();
- EXPECT_CALL(*gl_, BlendColor(0.0f, 0.0f, 0.0f, 0.0f))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, BlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, BlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0f, 0.0f, 0.0f))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearDepth(1.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, ClearStencil(0)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, ColorMask(true, true, true, true))
- .Times(1)
- .RetiresOnSaturation();
- if (feature_info()->feature_flags().chromium_framebuffer_mixed_samples) {
- EXPECT_CALL(*gl_, CoverageModulationNV(GL_NONE))
- .Times(1)
- .RetiresOnSaturation();
- }
- EXPECT_CALL(*gl_, CullFace(GL_BACK)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthFunc(GL_LESS)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthMask(true)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, DepthRange(0.0f, 1.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, FrontFace(GL_CCW)).Times(1).RetiresOnSaturation();
- if (!feature_info_->gl_version_info().is_desktop_core_profile) {
- EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().oes_standard_derivatives) {
- EXPECT_CALL(*gl_,
- Hint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, GL_DONT_CARE))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().chromium_texture_filtering_hint) {
- EXPECT_CALL(*gl_, Hint(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST))
- .Times(1)
- .RetiresOnSaturation();
- }
- SetupInitStateManualExpectationsForDoLineWidth(1.0f);
- if (feature_info_->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, MatrixLoadfEXT(GL_PATH_MODELVIEW_CHROMIUM, _))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info_->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, MatrixLoadfEXT(GL_PATH_PROJECTION_CHROMIUM, _))
- .Times(1)
- .RetiresOnSaturation();
- }
- if (feature_info()->feature_flags().chromium_path_rendering) {
- EXPECT_CALL(*gl_, PathStencilFuncNV(GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- }
- EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PolygonOffset(0.0f, 0.0f)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_, SampleCoverage(1.0f, false)).Times(1).RetiresOnSaturation();
- EXPECT_CALL(*gl_,
- Scissor(kViewportX, kViewportY, kViewportWidth, kViewportHeight))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0xFFFFFFFFU))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, StencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_,
- Viewport(kViewportX, kViewportY, kViewportWidth, kViewportHeight))
- .Times(1)
- .RetiresOnSaturation();
- SetupInitStateManualExpectations(es3_capable);
-}
-#endif // GPU_COMMAND_BUFFER_SERVICE_RASTER_DECODER_UNITTEST_0_AUTOGEN_H_
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_base.cc b/gpu/command_buffer/service/raster_decoder_unittest_base.cc
index 323c851..572b163 100644
--- a/gpu/command_buffer/service/raster_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/raster_decoder_unittest_base.cc
@@ -22,6 +22,7 @@
#include "gpu/command_buffer/common/raster_cmd_format.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/context_state_test_helpers.h"
#include "gpu/command_buffer/service/copy_texture_chromium_mock.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/logger.h"
@@ -113,38 +114,6 @@
}
}
-void RasterDecoderTestBase::SetupInitStateManualExpectations(bool es3_capable) {
- if (es3_capable) {
- EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ROW_LENGTH, 0))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ROW_LENGTH, 0))
- .Times(1)
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0))
- .Times(1)
- .RetiresOnSaturation();
- if (feature_info()->feature_flags().ext_window_rectangles) {
- EXPECT_CALL(*gl_, WindowRectanglesEXT(GL_EXCLUSIVE_EXT, 0, nullptr))
- .Times(1)
- .RetiresOnSaturation();
- }
- }
-}
-
-void RasterDecoderTestBase::SetupInitStateManualExpectationsForDoLineWidth(
- GLfloat width) {
- EXPECT_CALL(*gl_, LineWidth(width)).Times(1).RetiresOnSaturation();
-}
-
-void RasterDecoderTestBase::ExpectEnableDisable(GLenum cap, bool enable) {
- if (enable) {
- EXPECT_CALL(*gl_, Enable(cap)).Times(1).RetiresOnSaturation();
- } else {
- EXPECT_CALL(*gl_, Disable(cap)).Times(1).RetiresOnSaturation();
- }
-}
-
gpu::Mailbox RasterDecoderTestBase::CreateFakeTexture(
GLuint service_id,
viz::ResourceFormat resource_format,
@@ -203,8 +172,8 @@
EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VERTEX_ATTRIBS, _))
.WillOnce(SetArgPointee<1>(8u))
.RetiresOnSaturation();
- SetupInitCapabilitiesExpectations(feature_info()->IsES3Capable());
- SetupInitStateExpectations(feature_info()->IsES3Capable());
+ ContextStateTestHelpers::SetupInitState(gl_.get(), feature_info(),
+ gfx::Size(1, 1));
shared_context_state_ = base::MakeRefCounted<SharedContextState>(
new gl::GLShareGroup(), surface_, context_,
@@ -400,21 +369,11 @@
#endif
}
-// Include the auto-generated part of this file. We split this because it means
-// we can easily edit the non-auto generated parts right here in this file
-// instead of having to edit some template or the code generator.
-#include "gpu/command_buffer/service/raster_decoder_unittest_0_autogen.h"
-
// GCC requires these declarations, but MSVC requires they not be present
#ifndef COMPILER_MSVC
const GLint RasterDecoderTestBase::kMaxTextureSize;
const GLint RasterDecoderTestBase::kNumTextureUnits;
-const GLint RasterDecoderTestBase::kViewportX;
-const GLint RasterDecoderTestBase::kViewportY;
-const GLint RasterDecoderTestBase::kViewportWidth;
-const GLint RasterDecoderTestBase::kViewportHeight;
-
const GLuint RasterDecoderTestBase::kServiceBufferId;
const GLuint RasterDecoderTestBase::kServiceTextureId;
const GLuint RasterDecoderTestBase::kServiceVertexArrayId;
diff --git a/gpu/command_buffer/service/raster_decoder_unittest_base.h b/gpu/command_buffer/service/raster_decoder_unittest_base.h
index 8b321db..042994e3 100644
--- a/gpu/command_buffer/service/raster_decoder_unittest_base.h
+++ b/gpu/command_buffer/service/raster_decoder_unittest_base.h
@@ -153,12 +153,6 @@
typedef gles2::TestHelper::AttribInfo AttribInfo;
typedef gles2::TestHelper::UniformInfo UniformInfo;
- void SetupInitCapabilitiesExpectations(bool es3_capable);
- void SetupInitStateExpectations(bool es3_capable);
- void SetupInitStateManualExpectations(bool es3_capable);
- void SetupInitStateManualExpectationsForDoLineWidth(GLfloat width);
- void ExpectEnableDisable(GLenum cap, bool enable);
-
gpu::Mailbox CreateFakeTexture(GLuint service_id,
viz::ResourceFormat resource_format,
GLsizei width,
@@ -198,11 +192,6 @@
static const GLint kNumTextureUnits = 8;
static const GLint kNumVertexAttribs = 16;
- static const GLint kViewportX = 0;
- static const GLint kViewportY = 0;
- static const GLint kViewportWidth = 1;
- static const GLint kViewportHeight = 1;
-
static const GLuint kServiceBufferId = 301;
static const GLuint kServiceTextureId = 304;
static const GLuint kServiceVertexArrayId = 310;