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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h

Issue 661220: Added support for glGetString, glGetShaderSource,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h (revision 40176)
+++ gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h (working copy)
@@ -10,7 +10,6 @@
TEST_F(GLES2DecoderTest1, ActiveTextureValidArgs) {
- EXPECT_CALL(*gl_, ActiveTexture(1));
SpecializedSetup<ActiveTexture, 0>();
ActiveTexture cmd;
cmd.Init(1);
@@ -1113,9 +1112,39 @@
kInvalidSharedMemoryOffset);
EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
}
-// TODO(gman): GetProgramInfoLog
+TEST_F(GLES2DecoderTest1, GetProgramInfoLogValidArgs) {
+ const char* kInfo = "hello";
+ const uint32 kBucketId = 123;
+ SpecializedSetup<GetProgramInfoLog, 0>();
+ EXPECT_CALL(
+ *gl_, GetProgramiv(
+ kServiceProgramId, GL_INFO_LOG_LENGTH, _)) .WillOnce(
+ SetArgumentPointee<2>(strlen(kInfo)));
+ EXPECT_CALL(
+ *gl_, GetProgramInfoLog(kServiceProgramId, strlen(kInfo) + 1, _, _))
+ .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)),
+ SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1)));
+ GetProgramInfoLog cmd;
+ cmd.Init(client_program_id_, kBucketId);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
+ ASSERT_TRUE(bucket != NULL);
+ EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
+ EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo,
+ bucket->size()));
+}
+TEST_F(GLES2DecoderTest1, GetProgramInfoLogInvalidArgs) {
+ const uint32 kBucketId = 123;
+ EXPECT_CALL(*gl_, GetProgramInfoLog(_, _, _, _))
+ .Times(0);
+ GetProgramInfoLog cmd;
+ cmd.Init(kInvalidClientId, kBucketId);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_F(GLES2DecoderTest1, GetRenderbufferParameterivValidArgs) {
EXPECT_CALL(
*gl_, GetRenderbufferParameterivEXT(
@@ -1177,21 +1206,44 @@
kInvalidSharedMemoryOffset);
EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
}
-// TODO(gman): GetShaderInfoLog
+TEST_F(GLES2DecoderTest1, GetShaderInfoLogValidArgs) {
+ const char* kInfo = "hello";
+ const uint32 kBucketId = 123;
+ SpecializedSetup<GetShaderInfoLog, 0>();
+ EXPECT_CALL(
+ *gl_, GetShaderiv(
+ kServiceShaderId, GL_INFO_LOG_LENGTH, _)) .WillOnce(
+ SetArgumentPointee<2>(strlen(kInfo)));
+ EXPECT_CALL(
+ *gl_, GetShaderInfoLog(kServiceShaderId, strlen(kInfo) + 1, _, _))
+ .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)),
+ SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1)));
+ GetShaderInfoLog cmd;
+ cmd.Init(client_shader_id_, kBucketId);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
+ ASSERT_TRUE(bucket != NULL);
+ EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
+ EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo,
+ bucket->size()));
+}
+
+TEST_F(GLES2DecoderTest1, GetShaderInfoLogInvalidArgs) {
+ const uint32 kBucketId = 123;
+ EXPECT_CALL(*gl_, GetShaderInfoLog(_, _, _, _))
+ .Times(0);
+ GetShaderInfoLog cmd;
+ cmd.Init(kInvalidClientId, kBucketId);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
// TODO(gman): GetShaderPrecisionFormat
// TODO(gman): GetShaderSource
+// TODO(gman): GetString
-TEST_F(GLES2DecoderTest1, GetStringValidArgs) {
- EXPECT_CALL(*gl_, GetString(GL_VENDOR));
- SpecializedSetup<GetString, 0>();
- GetString cmd;
- cmd.Init(GL_VENDOR);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
-}
-
TEST_F(GLES2DecoderTest1, GetTexParameterfvValidArgs) {
EXPECT_CALL(
*gl_, GetTexParameterfv(

Powered by Google App Engine
This is Rietveld 408576698