Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 1165553003: Fine tuning glGetInternalformativ. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 EXPECT_TRUE(mem != nullptr); 3737 EXPECT_TRUE(mem != nullptr);
3738 3738
3739 std::vector<uint8_t> data(16); 3739 std::vector<uint8_t> data(16);
3740 // DeleteBuffers unmaps the data store. 3740 // DeleteBuffers unmaps the data store.
3741 gl_->DeleteBuffers(1, &kBufferId); 3741 gl_->DeleteBuffers(1, &kBufferId);
3742 3742
3743 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER)); 3743 EXPECT_FALSE(gl_->UnmapBuffer(GL_ARRAY_BUFFER));
3744 EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); 3744 EXPECT_EQ(GL_INVALID_OPERATION, CheckError());
3745 } 3745 }
3746 3746
3747 TEST_F(GLES2ImplementationTest, GetInternalformativ) {
3748 const GLint kNumSampleCounts = 8;
3749 struct Cmds {
3750 cmds::GetInternalformativ cmd;
3751 };
3752 typedef cmds::GetInternalformativ::Result::Type ResultType;
3753 ResultType result = 0;
3754 Cmds expected;
3755 ExpectedMemoryInfo result1 =
3756 GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType));
3757 expected.cmd.Init(123, GL_RGBA8, GL_NUM_SAMPLE_COUNTS,
3758 result1.id, result1.offset);
3759 EXPECT_CALL(*command_buffer(), OnFlush())
3760 .WillOnce(SetMemory(result1.ptr,
3761 SizedResultHelper<ResultType>(kNumSampleCounts)))
3762 .RetiresOnSaturation();
3763 gl_->GetInternalformativ(123, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 1, &result);
3764 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
3765 EXPECT_EQ(static_cast<ResultType>(kNumSampleCounts), result);
3766 }
3767
3747 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { 3768 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
3748 ContextInitOptions init_options; 3769 ContextInitOptions init_options;
3749 init_options.lose_context_when_out_of_memory = true; 3770 init_options.lose_context_when_out_of_memory = true;
3750 ASSERT_TRUE(Initialize(init_options)); 3771 ASSERT_TRUE(Initialize(init_options));
3751 3772
3752 struct Cmds { 3773 struct Cmds {
3753 cmds::LoseContextCHROMIUM cmd; 3774 cmds::LoseContextCHROMIUM cmd;
3754 }; 3775 };
3755 3776
3756 GLsizei max = std::numeric_limits<GLsizei>::max(); 3777 GLsizei max = std::numeric_limits<GLsizei>::max();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { 3817 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) {
3797 ContextInitOptions init_options; 3818 ContextInitOptions init_options;
3798 init_options.transfer_buffer_initialize_fail = true; 3819 init_options.transfer_buffer_initialize_fail = true;
3799 EXPECT_FALSE(Initialize(init_options)); 3820 EXPECT_FALSE(Initialize(init_options));
3800 } 3821 }
3801 3822
3802 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 3823 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
3803 3824
3804 } // namespace gles2 3825 } // namespace gles2
3805 } // namespace gpu 3826 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698