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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 3537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 EXPECT_EQ(GL_NO_ERROR, CheckError()); | 3548 EXPECT_EQ(GL_NO_ERROR, CheckError()); |
3549 | 3549 |
3550 gl_->TraceEndCHROMIUM(); | 3550 gl_->TraceEndCHROMIUM(); |
3551 EXPECT_EQ(GL_NO_ERROR, CheckError()); | 3551 EXPECT_EQ(GL_NO_ERROR, CheckError()); |
3552 | 3552 |
3553 // No more corresponding begin tracer marker should error. | 3553 // No more corresponding begin tracer marker should error. |
3554 gl_->TraceEndCHROMIUM(); | 3554 gl_->TraceEndCHROMIUM(); |
3555 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); | 3555 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); |
3556 } | 3556 } |
3557 | 3557 |
| 3558 TEST_F(GLES2ImplementationTest, IsEnabled) { |
| 3559 // If we use a valid enum, its state is cached on client side, so no command |
| 3560 // is actually generated, and this test will fail. |
| 3561 // TODO(zmo): it seems we never need the command. Maybe remove it. |
| 3562 GLenum kCap = 1; |
| 3563 struct Cmds { |
| 3564 cmds::IsEnabled cmd; |
| 3565 }; |
| 3566 |
| 3567 Cmds expected; |
| 3568 ExpectedMemoryInfo result1 = |
| 3569 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result)); |
| 3570 expected.cmd.Init(kCap, result1.id, result1.offset); |
| 3571 |
| 3572 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 3573 .WillOnce(SetMemory(result1.ptr, uint32_t(kCap))) |
| 3574 .RetiresOnSaturation(); |
| 3575 |
| 3576 GLboolean result = gl_->IsEnabled(kCap); |
| 3577 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3578 EXPECT_TRUE(result); |
| 3579 } |
| 3580 |
3558 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { | 3581 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { |
3559 ContextInitOptions init_options; | 3582 ContextInitOptions init_options; |
3560 init_options.lose_context_when_out_of_memory = true; | 3583 init_options.lose_context_when_out_of_memory = true; |
3561 ASSERT_TRUE(Initialize(init_options)); | 3584 ASSERT_TRUE(Initialize(init_options)); |
3562 | 3585 |
3563 struct Cmds { | 3586 struct Cmds { |
3564 cmds::LoseContextCHROMIUM cmd; | 3587 cmds::LoseContextCHROMIUM cmd; |
3565 }; | 3588 }; |
3566 | 3589 |
3567 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3590 GLsizei max = std::numeric_limits<GLsizei>::max(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3607 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { | 3630 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { |
3608 ContextInitOptions init_options; | 3631 ContextInitOptions init_options; |
3609 init_options.transfer_buffer_initialize_fail = true; | 3632 init_options.transfer_buffer_initialize_fail = true; |
3610 EXPECT_FALSE(Initialize(init_options)); | 3633 EXPECT_FALSE(Initialize(init_options)); |
3611 } | 3634 } |
3612 | 3635 |
3613 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3636 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3614 | 3637 |
3615 } // namespace gles2 | 3638 } // namespace gles2 |
3616 } // namespace gpu | 3639 } // namespace gpu |
OLD | NEW |