| OLD | NEW | 
|     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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |     5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 
|     6  |     6  | 
|     7 #include <algorithm> |     7 #include <algorithm> | 
|     8 #include <string> |     8 #include <string> | 
|     9 #include <vector> |     9 #include <vector> | 
|    10  |    10  | 
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   563     GLuint client_id, GLuint service_id) { |   563     GLuint client_id, GLuint service_id) { | 
|   564   EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) |   564   EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) | 
|   565       .Times(1) |   565       .Times(1) | 
|   566       .WillOnce(Return(reinterpret_cast<GLsync>(service_id))) |   566       .WillOnce(Return(reinterpret_cast<GLsync>(service_id))) | 
|   567       .RetiresOnSaturation(); |   567       .RetiresOnSaturation(); | 
|   568   cmds::FenceSync cmd; |   568   cmds::FenceSync cmd; | 
|   569   cmd.Init(client_id); |   569   cmd.Init(client_id); | 
|   570   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |   570   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 
|   571 } |   571 } | 
|   572  |   572  | 
|   573 void GLES2DecoderTestBase::SetBucketAsCString( |   573 void GLES2DecoderTestBase::SetBucketData( | 
|   574     uint32 bucket_id, const char* str) { |   574     uint32_t bucket_id, const void* data, uint32_t data_size) { | 
|   575   uint32 size = str ? (strlen(str) + 1) : 0; |   575   DCHECK(data || data_size == 0); | 
|   576   cmd::SetBucketSize cmd1; |   576   cmd::SetBucketSize cmd1; | 
|   577   cmd1.Init(bucket_id, size); |   577   cmd1.Init(bucket_id, data_size); | 
|   578   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); |   578   EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); | 
|   579   if (str) { |   579   if (data) { | 
|   580     memcpy(shared_memory_address_, str, size); |   580     memcpy(shared_memory_address_, data, data_size); | 
|   581     cmd::SetBucketData cmd2; |   581     cmd::SetBucketData cmd2; | 
|   582     cmd2.Init(bucket_id, 0, size, kSharedMemoryId, kSharedMemoryOffset); |   582     cmd2.Init(bucket_id, 0, data_size, kSharedMemoryId, kSharedMemoryOffset); | 
|   583     EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |   583     EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 
|   584     ClearSharedMemory(); |   584     ClearSharedMemory(); | 
|   585   } |   585   } | 
|   586 } |   586 } | 
|   587  |   587  | 
 |   588 void GLES2DecoderTestBase::SetBucketAsCString( | 
 |   589     uint32 bucket_id, const char* str) { | 
 |   590   SetBucketData(bucket_id, str, str ? (strlen(str) + 1) : 0); | 
 |   591 } | 
 |   592  | 
|   588 void GLES2DecoderTestBase::SetBucketAsCStrings( |   593 void GLES2DecoderTestBase::SetBucketAsCStrings( | 
|   589     uint32 bucket_id, GLsizei count, const char** str, |   594     uint32 bucket_id, GLsizei count, const char** str, | 
|   590     GLsizei count_in_header, char str_end) { |   595     GLsizei count_in_header, char str_end) { | 
|   591   uint32_t header_size = sizeof(GLint) * (count + 1); |   596   uint32_t header_size = sizeof(GLint) * (count + 1); | 
|   592   uint32_t total_size = header_size; |   597   uint32_t total_size = header_size; | 
|   593   scoped_ptr<GLint[]> header(new GLint[count + 1]); |   598   scoped_ptr<GLint[]> header(new GLint[count + 1]); | 
|   594   header[0] = static_cast<GLint>(count_in_header); |   599   header[0] = static_cast<GLint>(count_in_header); | 
|   595   for (GLsizei ii = 0; ii < count; ++ii) { |   600   for (GLsizei ii = 0; ii < count; ++ii) { | 
|   596     header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0; |   601     header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0; | 
|   597     total_size += header[ii + 1] + 1; |   602     total_size += header[ii + 1] + 1; | 
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1764   SetupDefaultProgram(); |  1769   SetupDefaultProgram(); | 
|  1765 } |  1770 } | 
|  1766  |  1771  | 
|  1767 // Include the auto-generated part of this file. We split this because it means |  1772 // Include the auto-generated part of this file. We split this because it means | 
|  1768 // we can easily edit the non-auto generated parts right here in this file |  1773 // we can easily edit the non-auto generated parts right here in this file | 
|  1769 // instead of having to edit some template or the code generator. |  1774 // instead of having to edit some template or the code generator. | 
|  1770 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |  1775 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 
|  1771  |  1776  | 
|  1772 }  // namespace gles2 |  1777 }  // namespace gles2 | 
|  1773 }  // namespace gpu |  1778 }  // namespace gpu | 
| OLD | NEW |