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/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/strings/string_tokenizer.h" | 11 #include "base/strings/string_tokenizer.h" |
12 #include "gpu/command_buffer/common/types.h" | 12 #include "gpu/command_buffer/common/types.h" |
| 13 #include "gpu/command_buffer/service/buffer_manager.h" |
13 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
14 #include "gpu/command_buffer/service/program_manager.h" | 16 #include "gpu/command_buffer/service/program_manager.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "ui/gl/gl_mock.h" | 18 #include "ui/gl/gl_mock.h" |
17 | 19 |
18 using ::testing::_; | 20 using ::testing::_; |
19 using ::testing::DoAll; | 21 using ::testing::DoAll; |
20 using ::testing::InSequence; | 22 using ::testing::InSequence; |
21 using ::testing::MatcherCast; | 23 using ::testing::MatcherCast; |
22 using ::testing::Pointee; | 24 using ::testing::Pointee; |
23 using ::testing::Return; | 25 using ::testing::Return; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 486 |
485 EXPECT_CALL(*gl, | 487 EXPECT_CALL(*gl, |
486 LinkProgram(service_id)) | 488 LinkProgram(service_id)) |
487 .Times(1) | 489 .Times(1) |
488 .RetiresOnSaturation(); | 490 .RetiresOnSaturation(); |
489 | 491 |
490 SetupProgramSuccessExpectations( | 492 SetupProgramSuccessExpectations( |
491 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); | 493 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); |
492 } | 494 } |
493 | 495 |
| 496 void TestHelper::DoBufferData( |
| 497 ::gfx::MockGLInterface* gl, MockGLES2Decoder* decoder, |
| 498 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage, |
| 499 const GLvoid* data, GLenum error) { |
| 500 EXPECT_CALL(*decoder, CopyRealGLErrorsToWrapper()) |
| 501 .Times(1) |
| 502 .RetiresOnSaturation(); |
| 503 if (manager->IsUsageClientSideArray(usage)) { |
| 504 EXPECT_CALL(*gl, BufferData( |
| 505 buffer->target(), 0, _, usage)) |
| 506 .Times(1) |
| 507 .RetiresOnSaturation(); |
| 508 } else { |
| 509 EXPECT_CALL(*gl, BufferData( |
| 510 buffer->target(), size, _, usage)) |
| 511 .Times(1) |
| 512 .RetiresOnSaturation(); |
| 513 } |
| 514 EXPECT_CALL(*decoder, PeekGLError()) |
| 515 .WillOnce(Return(error)) |
| 516 .RetiresOnSaturation(); |
| 517 manager->DoBufferData(decoder, buffer, size, usage, data); |
| 518 } |
| 519 |
494 } // namespace gles2 | 520 } // namespace gles2 |
495 } // namespace gpu | 521 } // namespace gpu |
496 | 522 |
OLD | NEW |