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/buffer_manager.h" |
14 #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" | 15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
16 #include "gpu/command_buffer/service/program_manager.h" | 16 #include "gpu/command_buffer/service/program_manager.h" |
| 17 #include "gpu/command_buffer/service/texture_manager.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gl/gl_mock.h" | 19 #include "ui/gl/gl_mock.h" |
19 | 20 |
20 using ::testing::_; | 21 using ::testing::_; |
21 using ::testing::DoAll; | 22 using ::testing::DoAll; |
22 using ::testing::InSequence; | 23 using ::testing::InSequence; |
23 using ::testing::MatcherCast; | 24 using ::testing::MatcherCast; |
24 using ::testing::Pointee; | 25 using ::testing::Pointee; |
25 using ::testing::Return; | 26 using ::testing::Return; |
26 using ::testing::SetArrayArgument; | 27 using ::testing::SetArrayArgument; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 buffer->target(), size, _, usage)) | 511 buffer->target(), size, _, usage)) |
511 .Times(1) | 512 .Times(1) |
512 .RetiresOnSaturation(); | 513 .RetiresOnSaturation(); |
513 } | 514 } |
514 EXPECT_CALL(*decoder, PeekGLError()) | 515 EXPECT_CALL(*decoder, PeekGLError()) |
515 .WillOnce(Return(error)) | 516 .WillOnce(Return(error)) |
516 .RetiresOnSaturation(); | 517 .RetiresOnSaturation(); |
517 manager->DoBufferData(decoder, buffer, size, usage, data); | 518 manager->DoBufferData(decoder, buffer, size, usage, data); |
518 } | 519 } |
519 | 520 |
| 521 void TestHelper::SetTexParameterWithExpectations( |
| 522 ::gfx::MockGLInterface* gl, MockGLES2Decoder* decoder, |
| 523 TextureManager* manager, Texture* texture, |
| 524 GLenum pname, GLint value, GLenum error) { |
| 525 if (error == GL_NO_ERROR) { |
| 526 if (pname != GL_TEXTURE_POOL_CHROMIUM) { |
| 527 EXPECT_CALL(*gl, TexParameteri(texture->target(), pname, value)) |
| 528 .Times(1) |
| 529 .RetiresOnSaturation(); |
| 530 } |
| 531 } else if (error == GL_INVALID_ENUM) { |
| 532 EXPECT_CALL(*decoder, SetGLErrorInvalidEnum(_, value, _)) |
| 533 .Times(1) |
| 534 .RetiresOnSaturation(); |
| 535 } else { |
| 536 EXPECT_CALL(*decoder, SetGLErrorInvalidParam(error, _, _, _)) |
| 537 .Times(1) |
| 538 .RetiresOnSaturation(); |
| 539 } |
| 540 manager->SetParameter("", decoder, texture, pname, value); |
| 541 } |
| 542 |
520 } // namespace gles2 | 543 } // namespace gles2 |
521 } // namespace gpu | 544 } // namespace gpu |
522 | 545 |
OLD | NEW |