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 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { | 3243 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { |
3244 ContextInitOptions init_options; | 3244 ContextInitOptions init_options; |
3245 init_options.lose_context_when_out_of_memory = true; | 3245 init_options.lose_context_when_out_of_memory = true; |
3246 ASSERT_TRUE(Initialize(init_options)); | 3246 ASSERT_TRUE(Initialize(init_options)); |
3247 | 3247 |
3248 struct Cmds { | 3248 struct Cmds { |
3249 cmds::LoseContextCHROMIUM cmd; | 3249 cmds::LoseContextCHROMIUM cmd; |
3250 }; | 3250 }; |
3251 | 3251 |
3252 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3252 GLsizei max = std::numeric_limits<GLsizei>::max(); |
3253 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) | 3253 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) |
3254 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); | 3254 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); |
3255 gl_->CreateImageCHROMIUM(max, max, 0); | 3255 gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); |
3256 // The context should be lost. | 3256 // The context should be lost. |
3257 Cmds expected; | 3257 Cmds expected; |
3258 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); | 3258 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); |
3259 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3259 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3260 } | 3260 } |
3261 | 3261 |
3262 TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) { | 3262 TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) { |
3263 ContextInitOptions init_options; | 3263 ContextInitOptions init_options; |
3264 ASSERT_TRUE(Initialize(init_options)); | 3264 ASSERT_TRUE(Initialize(init_options)); |
3265 | 3265 |
3266 struct Cmds { | 3266 struct Cmds { |
3267 cmds::LoseContextCHROMIUM cmd; | 3267 cmds::LoseContextCHROMIUM cmd; |
3268 }; | 3268 }; |
3269 | 3269 |
3270 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3270 GLsizei max = std::numeric_limits<GLsizei>::max(); |
3271 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) | 3271 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) |
3272 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); | 3272 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); |
3273 gl_->CreateImageCHROMIUM(max, max, 0); | 3273 gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); |
3274 // The context should not be lost. | 3274 // The context should not be lost. |
3275 EXPECT_TRUE(NoCommandsWritten()); | 3275 EXPECT_TRUE(NoCommandsWritten()); |
3276 } | 3276 } |
3277 | 3277 |
3278 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) { | 3278 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) { |
3279 ContextInitOptions init_options; | 3279 ContextInitOptions init_options; |
3280 init_options.bind_generates_resource_client = false; | 3280 init_options.bind_generates_resource_client = false; |
3281 init_options.bind_generates_resource_service = true; | 3281 init_options.bind_generates_resource_service = true; |
3282 EXPECT_FALSE(Initialize(init_options)); | 3282 EXPECT_FALSE(Initialize(init_options)); |
3283 } | 3283 } |
3284 | 3284 |
3285 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) { | 3285 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) { |
3286 ContextInitOptions init_options; | 3286 ContextInitOptions init_options; |
3287 init_options.bind_generates_resource_client = true; | 3287 init_options.bind_generates_resource_client = true; |
3288 init_options.bind_generates_resource_service = false; | 3288 init_options.bind_generates_resource_service = false; |
3289 EXPECT_FALSE(Initialize(init_options)); | 3289 EXPECT_FALSE(Initialize(init_options)); |
3290 } | 3290 } |
3291 | 3291 |
3292 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3292 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3293 | 3293 |
3294 } // namespace gles2 | 3294 } // namespace gles2 |
3295 } // namespace gpu | 3295 } // namespace gpu |
OLD | NEW |