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

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: Rebase 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 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/client/gles2_interface_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698