| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 7 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 9 | 9 |
| 10 using ::gfx::MockGLInterface; | 10 using ::gfx::MockGLInterface; |
| 11 using ::testing::_; | 11 using ::testing::_; |
| 12 using ::testing::Return; | 12 using ::testing::Return; |
| 13 using ::testing::SetArgPointee; | 13 using ::testing::SetArgPointee; |
| 14 | 14 |
| 15 namespace gpu { | 15 namespace gpu { |
| 16 namespace gles2 { | 16 namespace gles2 { |
| 17 | 17 |
| 18 using namespace cmds; | 18 using namespace cmds; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 } // namespace anonymous | 22 } // namespace anonymous |
| 23 | 23 |
| 24 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgs) { |
| 25 EXPECT_CALL( |
| 26 *gl_, BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kServiceBufferId)); |
| 27 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, _)) |
| 28 .WillOnce(SetArgPointee<1>(4)) |
| 29 .RetiresOnSaturation(); |
| 30 SpecializedSetup<cmds::BindBufferBase, 0>(true); |
| 31 cmds::BindBufferBase cmd; |
| 32 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, client_buffer_id_); |
| 33 decoder_->set_unsafe_es3_apis_enabled(true); |
| 34 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 35 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 36 decoder_->set_unsafe_es3_apis_enabled(false); |
| 37 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); |
| 38 } |
| 39 |
| 40 TEST_P(GLES2DecoderTest, BindBufferBaseValidArgsNewId) { |
| 41 EXPECT_CALL(*gl_, |
| 42 BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewServiceId)); |
| 43 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, _)) |
| 44 .WillOnce(SetArgPointee<1>(4)) |
| 45 .RetiresOnSaturation(); |
| 46 EXPECT_CALL(*gl_, GenBuffersARB(1, _)) |
| 47 .WillOnce(SetArgPointee<1>(kNewServiceId)); |
| 48 SpecializedSetup<cmds::BindBufferBase, 0>(true); |
| 49 cmds::BindBufferBase cmd; |
| 50 cmd.Init(GL_TRANSFORM_FEEDBACK_BUFFER, 2, kNewClientId); |
| 51 decoder_->set_unsafe_es3_apis_enabled(true); |
| 52 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 53 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 54 EXPECT_TRUE(GetBuffer(kNewClientId) != NULL); |
| 55 decoder_->set_unsafe_es3_apis_enabled(false); |
| 56 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); |
| 57 } |
| 58 |
| 24 TEST_P(GLES2DecoderTest, MapBufferRangeUnmapBufferReadSucceeds) { | 59 TEST_P(GLES2DecoderTest, MapBufferRangeUnmapBufferReadSucceeds) { |
| 25 const GLenum kTarget = GL_ARRAY_BUFFER; | 60 const GLenum kTarget = GL_ARRAY_BUFFER; |
| 26 const GLintptr kOffset = 10; | 61 const GLintptr kOffset = 10; |
| 27 const GLsizeiptr kSize = 64; | 62 const GLsizeiptr kSize = 64; |
| 28 const GLbitfield kAccess = GL_MAP_READ_BIT; | 63 const GLbitfield kAccess = GL_MAP_READ_BIT; |
| 29 | 64 |
| 30 uint32_t result_shm_id = kSharedMemoryId; | 65 uint32_t result_shm_id = kSharedMemoryId; |
| 31 uint32_t result_shm_offset = kSharedMemoryOffset; | 66 uint32_t result_shm_offset = kSharedMemoryOffset; |
| 32 uint32_t data_shm_id = kSharedMemoryId; | 67 uint32_t data_shm_id = kSharedMemoryId; |
| 33 // uint32_t is Result for both MapBufferRange and UnmapBuffer commands. | 68 // uint32_t is Result for both MapBufferRange and UnmapBuffer commands. |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 { // UnmapBuffer fails. | 499 { // UnmapBuffer fails. |
| 465 UnmapBuffer cmd; | 500 UnmapBuffer cmd; |
| 466 cmd.Init(kTarget); | 501 cmd.Init(kTarget); |
| 467 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 502 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 468 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 503 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 469 } | 504 } |
| 470 } | 505 } |
| 471 | 506 |
| 472 } // namespace gles2 | 507 } // namespace gles2 |
| 473 } // namespace gpu | 508 } // namespace gpu |
| OLD | NEW |