parameters: (self, func, f)
docstring: Overrriden from TypeHandler.
docstring_summary: Overrriden from TypeHandler.
docstring_tokens: Overrriden from TypeHandler .
function: def WriteGLES2ImplementationUnitTest(self, func, f):
      """Overrriden from TypeHandler."""
      code = """
  TEST_F(GLES2ImplementationTest, %(name)s) {
    const uint32_t kBucketId = GLES2Implementation::kResultBucketId;
    const char* kString1 = "happy";
    const char* kString2 = "ending";
    const size_t kString1Size = ::strlen(kString1) + 1;
    const size_t kString2Size = ::strlen(kString2) + 1;
    const size_t kHeaderSize = sizeof(GLint) * 3;
    const size_t kSourceSize = kHeaderSize + kString1Size + kString2Size;
    const size_t kPaddedHeaderSize =
        transfer_buffer_->RoundToAlignment(kHeaderSize);
    const size_t kPaddedString1Size =
        transfer_buffer_->RoundToAlignment(kString1Size);
    const size_t kPaddedString2Size =
        transfer_buffer_->RoundToAlignment(kString2Size);
    struct Cmds {
      cmd::SetBucketSize set_bucket_size;
      cmd::SetBucketData set_bucket_header;
      cmd::SetToken set_token1;
      cmd::SetBucketData set_bucket_data1;
      cmd::SetToken set_token2;
      cmd::SetBucketData set_bucket_data2;
      cmd::SetToken set_token3;
      cmds::%(name)sBucket cmd_bucket;
      cmd::SetBucketSize clear_bucket_size;
    };
  
    ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
    ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedString1Size);
    ExpectedMemoryInfo mem2 = GetExpectedMemory(kPaddedString2Size);
  
    Cmds expected;
    expected.set_bucket_size.Init(kBucketId, kSourceSize);
    expected.set_bucket_header.Init(
        kBucketId, 0, kHeaderSize, mem0.id, mem0.offset);
    expected.set_token1.Init(GetNextToken());
    expected.set_bucket_data1.Init(
        kBucketId, kHeaderSize, kString1Size, mem1.id, mem1.offset);
    expected.set_token2.Init(GetNextToken());
    expected.set_bucket_data2.Init(
        kBucketId, kHeaderSize + kString1Size, kString2Size, mem2.id,
        mem2.offset);
    expected.set_token3.Init(GetNextToken());
    expected.cmd_bucket.Init(%(bucket_args)s);
    expected.clear_bucket_size.Init(kBucketId, 0);
    const char* kStrings[] = { kString1, kString2 };
    gl_->%(name)s(%(gl_args)s);
    EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  }
  """
      gl_args = []
      bucket_args = []
      for arg in func.GetOriginalArgs():
        if arg == self.__GetDataArg(func):
          gl_args.append('kStrings')
          bucket_args.append('kBucketId')
        elif arg == self.__GetLengthArg(func):
          gl_args.append('NULL')
        elif arg.name == 'count':
          gl_args.append('2')
        else:
          gl_args.append(arg.GetValidClientSideArg(func))
          bucket_args.append(arg.GetValidClientSideArg(func))
      f.write(code % {
          'name': func.name,
          'gl_args': ", ".join(gl_args),
          'bucket_args': ", ".join(bucket_args),
        })
  
      if self.__GetLengthArg(func) == None:
        return
      code = """
  TEST_F(GLES2ImplementationTest, %(name)sWithLength) {
    const uint32_t kBucketId = GLES2Implementation::kResultBucketId;
    const char* kString = "foobar******";
    const size_t kStringSize = 6;  // We only need "foobar".
    const size_t kHeaderSize = sizeof(GLint) * 2;
    const size_t kSourceSize = kHeaderSize + kStringSize + 1;
    const size_t kPaddedHeaderSize =
        transfer_buffer_->RoundToAlignment(kHeaderSize);
    const size_t kPaddedStringSize =
        transfer_buffer_->RoundToAlignment(kStringSize + 1);
    struct Cmds {
      cmd::SetBucketSize set_bucket_size;
      cmd::SetBucketData set_bucket_header;
      cmd::SetToken set_token1;
      cmd::SetBucketData set_bucket_data;
      cmd::SetToken set_token2;
      cmds::ShaderSourceBucket shader_source_bucket;
      cmd::SetBucketSize clear_bucket_size;
    };
  
    ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
    ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedStringSize);
  
    Cmds expected;
    expected.set_bucket_size.Init(kBucketId, kSourceSize);
    expected.set_bucket_header.Init(
        kBucketId, 0, kHeaderSize, mem0.id, mem0.offset);
    expected.set_token1.Init(GetNextToken());
    expected.set_bucket_data.Init(
        kBucketId, kHeaderSize, kStringSize + 1, mem1.id, mem1.offset);
    expected.set_token2.Init(GetNextToken());
    expected.shader_source_bucket.Init(%(bucket_args)s);
    expected.clear_bucket_size.Init(kBucketId, 0);
    const char* kStrings[] = { kString };
    const GLint kLength[] = { kStringSize };
    gl_->%(name)s(%(gl_args)s);
    EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  }
  """
      gl_args = []
      for arg in func.GetOriginalArgs():
        if arg == self.__GetDataArg(func):
          gl_args.append('kStrings')
        elif arg == self.__GetLengthArg(func):
          gl_args.append('kLength')
        elif arg.name == 'count':
          gl_args.append('1')
        else:
          gl_args.append(arg.GetValidClientSideArg(func))
      f.write(code % {
          'name': func.name,
          'gl_args': ", ".join(gl_args),
          'bucket_args': ", ".join(bucket_args),
        })
function_tokens: def WriteGLES2ImplementationUnitTest ( self , func , f ) : code = """
  TEST_F(GLES2ImplementationTest, %(name)s) {
    const uint32_t kBucketId = GLES2Implementation::kResultBucketId;
    const char* kString1 = "happy";
    const char* kString2 = "ending";
    const size_t kString1Size = ::strlen(kString1) + 1;
    const size_t kString2Size = ::strlen(kString2) + 1;
    const size_t kHeaderSize = sizeof(GLint) * 3;
    const size_t kSourceSize = kHeaderSize + kString1Size + kString2Size;
    const size_t kPaddedHeaderSize =
        transfer_buffer_->RoundToAlignment(kHeaderSize);
    const size_t kPaddedString1Size =
        transfer_buffer_->RoundToAlignment(kString1Size);
    const size_t kPaddedString2Size =
        transfer_buffer_->RoundToAlignment(kString2Size);
    struct Cmds {
      cmd::SetBucketSize set_bucket_size;
      cmd::SetBucketData set_bucket_header;
      cmd::SetToken set_token1;
      cmd::SetBucketData set_bucket_data1;
      cmd::SetToken set_token2;
      cmd::SetBucketData set_bucket_data2;
      cmd::SetToken set_token3;
      cmds::%(name)sBucket cmd_bucket;
      cmd::SetBucketSize clear_bucket_size;
    };
  
    ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
    ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedString1Size);
    ExpectedMemoryInfo mem2 = GetExpectedMemory(kPaddedString2Size);
  
    Cmds expected;
    expected.set_bucket_size.Init(kBucketId, kSourceSize);
    expected.set_bucket_header.Init(
        kBucketId, 0, kHeaderSize, mem0.id, mem0.offset);
    expected.set_token1.Init(GetNextToken());
    expected.set_bucket_data1.Init(
        kBucketId, kHeaderSize, kString1Size, mem1.id, mem1.offset);
    expected.set_token2.Init(GetNextToken());
    expected.set_bucket_data2.Init(
        kBucketId, kHeaderSize + kString1Size, kString2Size, mem2.id,
        mem2.offset);
    expected.set_token3.Init(GetNextToken());
    expected.cmd_bucket.Init(%(bucket_args)s);
    expected.clear_bucket_size.Init(kBucketId, 0);
    const char* kStrings[] = { kString1, kString2 };
    gl_->%(name)s(%(gl_args)s);
    EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  }
  """ gl_args = [ ] bucket_args = [ ] for arg in func . GetOriginalArgs ( ) : if arg == self . __GetDataArg ( func ) : gl_args . append ( 'kStrings' ) bucket_args . append ( 'kBucketId' ) elif arg == self . __GetLengthArg ( func ) : gl_args . append ( 'NULL' ) elif arg . name == 'count' : gl_args . append ( '2' ) else : gl_args . append ( arg . GetValidClientSideArg ( func ) ) bucket_args . append ( arg . GetValidClientSideArg ( func ) ) f . write ( code % { 'name' : func . name , 'gl_args' : ", " . join ( gl_args ) , 'bucket_args' : ", " . join ( bucket_args ) , } ) if self . __GetLengthArg ( func ) == None : return code = """
  TEST_F(GLES2ImplementationTest, %(name)sWithLength) {
    const uint32_t kBucketId = GLES2Implementation::kResultBucketId;
    const char* kString = "foobar******";
    const size_t kStringSize = 6;  // We only need "foobar".
    const size_t kHeaderSize = sizeof(GLint) * 2;
    const size_t kSourceSize = kHeaderSize + kStringSize + 1;
    const size_t kPaddedHeaderSize =
        transfer_buffer_->RoundToAlignment(kHeaderSize);
    const size_t kPaddedStringSize =
        transfer_buffer_->RoundToAlignment(kStringSize + 1);
    struct Cmds {
      cmd::SetBucketSize set_bucket_size;
      cmd::SetBucketData set_bucket_header;
      cmd::SetToken set_token1;
      cmd::SetBucketData set_bucket_data;
      cmd::SetToken set_token2;
      cmds::ShaderSourceBucket shader_source_bucket;
      cmd::SetBucketSize clear_bucket_size;
    };
  
    ExpectedMemoryInfo mem0 = GetExpectedMemory(kPaddedHeaderSize);
    ExpectedMemoryInfo mem1 = GetExpectedMemory(kPaddedStringSize);
  
    Cmds expected;
    expected.set_bucket_size.Init(kBucketId, kSourceSize);
    expected.set_bucket_header.Init(
        kBucketId, 0, kHeaderSize, mem0.id, mem0.offset);
    expected.set_token1.Init(GetNextToken());
    expected.set_bucket_data.Init(
        kBucketId, kHeaderSize, kStringSize + 1, mem1.id, mem1.offset);
    expected.set_token2.Init(GetNextToken());
    expected.shader_source_bucket.Init(%(bucket_args)s);
    expected.clear_bucket_size.Init(kBucketId, 0);
    const char* kStrings[] = { kString };
    const GLint kLength[] = { kStringSize };
    gl_->%(name)s(%(gl_args)s);
    EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  }
  """ gl_args = [ ] for arg in func . GetOriginalArgs ( ) : if arg == self . __GetDataArg ( func ) : gl_args . append ( 'kStrings' ) elif arg == self . __GetLengthArg ( func ) : gl_args . append ( 'kLength' ) elif arg . name == 'count' : gl_args . append ( '1' ) else : gl_args . append ( arg . GetValidClientSideArg ( func ) ) f . write ( code % { 'name' : func . name , 'gl_args' : ", " . join ( gl_args ) , 'bucket_args' : ", " . join ( bucket_args ) , } )