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 <string> |
| 8 #include <algorithm> |
| 9 |
7 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
8 #include "base/string_tokenizer.h" | 11 #include "base/string_tokenizer.h" |
9 #include "gpu/command_buffer/common/gl_mock.h" | 12 #include "gpu/command_buffer/common/gl_mock.h" |
10 #include "gpu/command_buffer/common/types.h" | 13 #include "gpu/command_buffer/common/types.h" |
11 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
12 #include "gpu/command_buffer/service/program_manager.h" | 15 #include "gpu/command_buffer/service/program_manager.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
14 | 17 |
15 #include <string.h> | |
16 | |
17 using ::testing::_; | 18 using ::testing::_; |
18 using ::testing::DoAll; | 19 using ::testing::DoAll; |
19 using ::testing::InSequence; | 20 using ::testing::InSequence; |
20 using ::testing::MatcherCast; | 21 using ::testing::MatcherCast; |
21 using ::testing::Pointee; | 22 using ::testing::Pointee; |
22 using ::testing::Return; | 23 using ::testing::Return; |
23 using ::testing::SetArrayArgument; | 24 using ::testing::SetArrayArgument; |
24 using ::testing::SetArgumentPointee; | 25 using ::testing::SetArgumentPointee; |
25 using ::testing::StrEq; | 26 using ::testing::StrEq; |
26 using ::testing::StrictMock; | 27 using ::testing::StrictMock; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 .Times(1) | 362 .Times(1) |
362 .RetiresOnSaturation(); | 363 .RetiresOnSaturation(); |
363 break; | 364 break; |
364 default: | 365 default: |
365 NOTREACHED(); | 366 NOTREACHED(); |
366 break; | 367 break; |
367 } | 368 } |
368 } | 369 } |
369 } | 370 } |
370 | 371 |
371 void TestHelper::SetupShader( | 372 void TestHelper::SetupProgramSuccessExpectations( |
372 ::gfx::MockGLInterface* gl, | 373 ::gfx::MockGLInterface* gl, |
373 AttribInfo* attribs, size_t num_attribs, | 374 AttribInfo* attribs, size_t num_attribs, |
374 UniformInfo* uniforms, size_t num_uniforms, | 375 UniformInfo* uniforms, size_t num_uniforms, |
375 GLuint service_id) { | 376 GLuint service_id) { |
376 InSequence s; | |
377 | |
378 EXPECT_CALL(*gl, | |
379 LinkProgram(service_id)) | |
380 .Times(1) | |
381 .RetiresOnSaturation(); | |
382 EXPECT_CALL(*gl, | 377 EXPECT_CALL(*gl, |
383 GetProgramiv(service_id, GL_LINK_STATUS, _)) | 378 GetProgramiv(service_id, GL_LINK_STATUS, _)) |
384 .WillOnce(SetArgumentPointee<2>(1)) | 379 .WillOnce(SetArgumentPointee<2>(1)) |
385 .RetiresOnSaturation(); | 380 .RetiresOnSaturation(); |
386 EXPECT_CALL(*gl, | 381 EXPECT_CALL(*gl, |
387 GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _)) | 382 GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _)) |
388 .WillOnce(SetArgumentPointee<2>(0)) | 383 .WillOnce(SetArgumentPointee<2>(0)) |
389 .RetiresOnSaturation(); | 384 .RetiresOnSaturation(); |
390 EXPECT_CALL(*gl, | 385 EXPECT_CALL(*gl, |
391 GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTES, _)) | 386 GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTES, _)) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 service_id, StrEq(element_name))) | 468 service_id, StrEq(element_name))) |
474 .WillOnce(Return(info.real_location + jj * 2)) | 469 .WillOnce(Return(info.real_location + jj * 2)) |
475 .RetiresOnSaturation(); | 470 .RetiresOnSaturation(); |
476 } | 471 } |
477 } | 472 } |
478 } | 473 } |
479 } | 474 } |
480 } | 475 } |
481 } | 476 } |
482 | 477 |
| 478 void TestHelper::SetupShader( |
| 479 ::gfx::MockGLInterface* gl, |
| 480 AttribInfo* attribs, size_t num_attribs, |
| 481 UniformInfo* uniforms, size_t num_uniforms, |
| 482 GLuint service_id) { |
| 483 InSequence s; |
| 484 |
| 485 EXPECT_CALL(*gl, |
| 486 LinkProgram(service_id)) |
| 487 .Times(1) |
| 488 .RetiresOnSaturation(); |
| 489 |
| 490 SetupProgramSuccessExpectations( |
| 491 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); |
| 492 } |
| 493 |
483 } // namespace gles2 | 494 } // namespace gles2 |
484 } // namespace gpu | 495 } // namespace gpu |
485 | 496 |
OLD | NEW |