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" | |
14 #include "gpu/command_buffer/service/gl_utils.h" | 13 #include "gpu/command_buffer/service/gl_utils.h" |
15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | |
16 #include "gpu/command_buffer/service/program_manager.h" | 14 #include "gpu/command_buffer/service/program_manager.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gl/gl_mock.h" | 16 #include "ui/gl/gl_mock.h" |
19 | 17 |
20 using ::testing::_; | 18 using ::testing::_; |
21 using ::testing::DoAll; | 19 using ::testing::DoAll; |
22 using ::testing::InSequence; | 20 using ::testing::InSequence; |
23 using ::testing::MatcherCast; | 21 using ::testing::MatcherCast; |
24 using ::testing::Pointee; | 22 using ::testing::Pointee; |
25 using ::testing::Return; | 23 using ::testing::Return; |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 484 |
487 EXPECT_CALL(*gl, | 485 EXPECT_CALL(*gl, |
488 LinkProgram(service_id)) | 486 LinkProgram(service_id)) |
489 .Times(1) | 487 .Times(1) |
490 .RetiresOnSaturation(); | 488 .RetiresOnSaturation(); |
491 | 489 |
492 SetupProgramSuccessExpectations( | 490 SetupProgramSuccessExpectations( |
493 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); | 491 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); |
494 } | 492 } |
495 | 493 |
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 | |
520 } // namespace gles2 | 494 } // namespace gles2 |
521 } // namespace gpu | 495 } // namespace gpu |
522 | 496 |
OLD | NEW |