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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

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.cc
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (revision 40176)
+++ gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc (working copy)
@@ -853,6 +853,7 @@
}
TEST_F(GLES2DecoderTest, ShaderSourceAndGetShaderSourceValidArgs) {
+ const uint32 kBucketId = 123;
const char kSource[] = "hello";
const uint32 kSourceSize = sizeof(kSource) - 1;
memcpy(shared_memory_address_, kSource, kSourceSize);
@@ -861,15 +862,14 @@
kSharedMemoryId, kSharedMemoryOffset, kSourceSize);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
memset(shared_memory_address_, 0, kSourceSize);
- // TODO(gman): GetShaderSource has to change format so result is always set.
GetShaderSource get_cmd;
- get_cmd.Init(client_shader_id_, kSourceSize + 1,
- kSharedMemoryId, kSharedMemoryOffset,
- kSharedMemoryId, kSharedMemoryOffset + sizeof(kSourceSize));
+ get_cmd.Init(client_shader_id_, kBucketId);
EXPECT_EQ(error::kNoError, ExecuteCmd(get_cmd));
- EXPECT_EQ(kSourceSize, *GetSharedMemoryAs<uint32*>());
- EXPECT_EQ(0, memcmp(GetSharedMemoryAsWithOffset<void*>(sizeof(kSourceSize)),
- kSource, kSourceSize));
+ CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
+ ASSERT_TRUE(bucket != NULL);
+ EXPECT_EQ(kSourceSize + 1, bucket->size());
+ EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kSource,
+ bucket->size()));
}
TEST_F(GLES2DecoderTest, ShaderSourceInvalidArgs) {
@@ -897,6 +897,7 @@
}
TEST_F(GLES2DecoderTest, ShaderSourceImmediateAndGetShaderSourceValidArgs) {
+ const uint32 kBucketId = 123;
const char kSource[] = "hello";
const uint32 kSourceSize = sizeof(kSource) - 1;
ShaderSourceImmediate& cmd = *GetImmediateAs<ShaderSourceImmediate>();
@@ -906,13 +907,13 @@
memset(shared_memory_address_, 0, kSourceSize);
// TODO(gman): GetShaderSource has to change format so result is always set.
GetShaderSource get_cmd;
- get_cmd.Init(client_shader_id_, kSourceSize + 1,
- kSharedMemoryId, kSharedMemoryOffset,
- kSharedMemoryId, kSharedMemoryOffset + sizeof(kSourceSize));
+ get_cmd.Init(client_shader_id_, kBucketId);
EXPECT_EQ(error::kNoError, ExecuteCmd(get_cmd));
- EXPECT_EQ(kSourceSize, *GetSharedMemoryAs<uint32*>());
- EXPECT_EQ(0, memcmp(GetSharedMemoryAsWithOffset<void*>(sizeof(kSourceSize)),
- kSource, kSourceSize));
+ CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
+ ASSERT_TRUE(bucket != NULL);
+ EXPECT_EQ(kSourceSize + 1, bucket->size());
+ EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kSource,
+ bucket->size()));
}
TEST_F(GLES2DecoderTest, ShaderSourceImmediateInvalidArgs) {

Powered by Google App Engine
This is Rietveld 408576698