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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 8404029: Strip comments from shader before checking for invalid characters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" 8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/common/gl_mock.h" 10 #include "gpu/command_buffer/common/gl_mock.h"
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 // Test no bucket. 1247 // Test no bucket.
1248 cmd.Init(client_texture_id_, kBucketId); 1248 cmd.Init(client_texture_id_, kBucketId);
1249 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 1249 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
1250 // Test invalid client. 1250 // Test invalid client.
1251 SetBucketAsCString(kBucketId, kSource); 1251 SetBucketAsCString(kBucketId, kSource);
1252 cmd.Init(kInvalidClientId, kBucketId); 1252 cmd.Init(kInvalidClientId, kBucketId);
1253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1253 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1254 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1254 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1255 } 1255 }
1256 1256
1257 TEST_F(GLES2DecoderTest, ShaderSourceStripComments) {
1258 const uint32 kInBucketId = 123;
1259 const char kSource[] = "hello/*te\ast*/world//a\ab";
1260 SetBucketAsCString(kInBucketId, kSource);
1261 ShaderSourceBucket cmd;
1262 cmd.Init(client_shader_id_, kInBucketId);
1263 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1264 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1265 }
1266
1257 TEST_F(GLES2DecoderTest, GenerateMipmapWrongFormatsFails) { 1267 TEST_F(GLES2DecoderTest, GenerateMipmapWrongFormatsFails) {
1258 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) 1268 EXPECT_CALL(*gl_, GenerateMipmapEXT(_))
1259 .Times(0); 1269 .Times(0);
1260 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1270 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1261 DoTexImage2D( 1271 DoTexImage2D(
1262 GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_UNSIGNED_BYTE, 1272 GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_UNSIGNED_BYTE,
1263 0, 0); 1273 0, 0);
1264 GenerateMipmap cmd; 1274 GenerateMipmap cmd;
1265 cmd.Init(GL_TEXTURE_2D); 1275 cmd.Init(GL_TEXTURE_2D);
1266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1276 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after
5018 // TODO(gman): TexImage2DImmediate 5028 // TODO(gman): TexImage2DImmediate
5019 5029
5020 // TODO(gman): TexSubImage2DImmediate 5030 // TODO(gman): TexSubImage2DImmediate
5021 5031
5022 // TODO(gman): UseProgram 5032 // TODO(gman): UseProgram
5023 5033
5024 // TODO(gman): SwapBuffers 5034 // TODO(gman): SwapBuffers
5025 5035
5026 } // namespace gles2 5036 } // namespace gles2
5027 } // namespace gpu 5037 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698