Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" | 16 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/context_state.h" | |
| 17 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 18 #include "gpu/command_buffer/service/logger.h" | 19 #include "gpu/command_buffer/service/logger.h" |
| 19 #include "gpu/command_buffer/service/program_manager.h" | 20 #include "gpu/command_buffer/service/program_manager.h" |
| 20 #include "gpu/command_buffer/service/test_helper.h" | 21 #include "gpu/command_buffer/service/test_helper.h" |
| 21 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 22 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/gl/gl_implementation.h" | 24 #include "ui/gl/gl_implementation.h" |
| 24 #include "ui/gl/gl_mock.h" | 25 #include "ui/gl/gl_mock.h" |
| 25 | 26 |
| 26 using ::gfx::MockGLInterface; | 27 using ::gfx::MockGLInterface; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 } | 73 } |
| 73 | 74 |
| 74 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { | 75 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { |
| 75 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { | 76 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { |
| 76 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) | 77 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) |
| 77 .Times(1) | 78 .Times(1) |
| 78 .RetiresOnSaturation(); | 79 .RetiresOnSaturation(); |
| 79 } | 80 } |
| 80 } | 81 } |
| 81 | 82 |
| 83 void GLES2DecoderTestBase::AddExpectationsForActiveTexture(GLenum unit) { | |
| 84 EXPECT_CALL(*gl_, ActiveTexture(unit)) | |
| 85 .Times(1) | |
| 86 .RetiresOnSaturation(); | |
| 87 } | |
| 88 | |
| 89 void GLES2DecoderTestBase::AddExpectationsForBindTexture(GLenum target, | |
| 90 GLuint id) { | |
| 91 EXPECT_CALL(*gl_, BindTexture(target, id)) | |
| 92 .Times(1) | |
| 93 .RetiresOnSaturation(); | |
| 94 } | |
| 95 | |
| 96 void GLES2DecoderTestBase::InitializeContextState(ContextState* state, | |
| 97 uint32 non_default_unit, | |
| 98 uint32 active_unit) { | |
|
no sievers
2014/01/13 22:06:29
This seems to be very specific to your tests.
How
kaanb
2014/01/14 22:04:22
Done.
| |
| 99 state->texture_units.resize(group().max_texture_units()); | |
| 100 for (uint32 tt = 0; tt < state->texture_units.size(); ++tt) { | |
| 101 TextureRef* ref_cube_map = | |
| 102 group().texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP); | |
| 103 state->texture_units[tt].bound_texture_cube_map = ref_cube_map; | |
| 104 TextureRef* ref_2d = | |
| 105 (tt == non_default_unit) | |
| 106 ? group().texture_manager()->GetTexture(client_texture_id_) | |
| 107 : group().texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D); | |
| 108 state->texture_units[tt].bound_texture_2d = ref_2d; | |
| 109 } | |
| 110 state->active_texture_unit = active_unit; | |
| 111 } | |
| 112 | |
| 82 void GLES2DecoderTestBase::InitDecoder( | 113 void GLES2DecoderTestBase::InitDecoder( |
| 83 const char* extensions, | 114 const char* extensions, |
| 84 bool has_alpha, | 115 bool has_alpha, |
| 85 bool has_depth, | 116 bool has_depth, |
| 86 bool has_stencil, | 117 bool has_stencil, |
| 87 bool request_alpha, | 118 bool request_alpha, |
| 88 bool request_depth, | 119 bool request_depth, |
| 89 bool request_stencil, | 120 bool request_stencil, |
| 90 bool bind_generates_resource) { | 121 bool bind_generates_resource) { |
| 91 InitDecoderWithCommandLine(extensions, | 122 InitDecoderWithCommandLine(extensions, |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1425 SetupDefaultProgram(); | 1456 SetupDefaultProgram(); |
| 1426 } | 1457 } |
| 1427 | 1458 |
| 1428 // Include the auto-generated part of this file. We split this because it means | 1459 // Include the auto-generated part of this file. We split this because it means |
| 1429 // we can easily edit the non-auto generated parts right here in this file | 1460 // we can easily edit the non-auto generated parts right here in this file |
| 1430 // instead of having to edit some template or the code generator. | 1461 // instead of having to edit some template or the code generator. |
| 1431 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1462 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1432 | 1463 |
| 1433 } // namespace gles2 | 1464 } // namespace gles2 |
| 1434 } // namespace gpu | 1465 } // namespace gpu |
| OLD | NEW |