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

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

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

Powered by Google App Engine
This is Rietveld 408576698