gpu/command_buffer/build_cmd_buffer_lib.py
def WriteGLES2ImplementationUnitTest(self, func, f):
    """Writes the GLES2 Implemention unit test."""
    code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  typedef cmds::%(name)s::Result::Type ResultType;
  ResultType result = 0;
  Cmds expected;
  ExpectedMemoryInfo result1 = GetExpectedResultMemory(
      sizeof(uint32_t) + sizeof(ResultType));
  expected.cmd.Init(%(cmd_args)s, result1.id, result1.offset);
  EXPECT_CALL(*command_buffer(), OnFlush())
      .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1)))
      .RetiresOnSaturation();
  gl_->%(name)s(%(args)s, &result);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  EXPECT_EQ(static_cast<ResultType>(1), result);
}
"""
    first_cmd_arg = func.GetCmdArgs()[0].GetValidNonCachedClientSideCmdArg(func)
    if not first_cmd_arg:
      return

    first_gl_arg = func.GetOriginalArgs()[0].GetValidNonCachedClientSideArg(
        func)

    cmd_arg_strings = [first_cmd_arg]
    for arg in func.GetCmdArgs()[1:-2]:
      cmd_arg_strings.append(arg.GetValidClientSideCmdArg(func))
    gl_arg_strings = [first_gl_arg]
    for arg in func.GetOriginalArgs()[1:-1]:
      gl_arg_strings.append(arg.GetValidClientSideArg(func))

    f.write(code % {
          'prefix' : _prefix,
          'name': func.name,
          'args': ", ".join(gl_arg_strings),
          'cmd_args': ", ".join(cmd_arg_strings),
        })
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
def WriteGLES2ImplementationUnitTest(self, func, f):
    code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  typedef cmds::%(name)s::Result::Type ResultType;
  ResultType result = 0;
  Cmds expected;
  ExpectedMemoryInfo result1 = GetExpectedResultMemory(
      sizeof(uint32_t) + sizeof(ResultType));
  expected.cmd.Init(%(cmd_args)s, result1.id, result1.offset);
  EXPECT_CALL(*command_buffer(), OnFlush())
      .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1)))
      .RetiresOnSaturation();
  gl_->%(name)s(%(args)s, &result);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  EXPECT_EQ(static_cast<ResultType>(1), result);
}
"""
    first_cmd_arg = func.GetCmdArgs()[0].GetValidNonCachedClientSideCmdArg(func)
    if not first_cmd_arg:
      return
    first_gl_arg = func.GetOriginalArgs()[0].GetValidNonCachedClientSideArg(
        func)
    cmd_arg_strings = [first_cmd_arg]
    for arg in func.GetCmdArgs()[1:-2]:
      cmd_arg_strings.append(arg.GetValidClientSideCmdArg(func))
    gl_arg_strings = [first_gl_arg]
    for arg in func.GetOriginalArgs()[1:-1]:
      gl_arg_strings.append(arg.GetValidClientSideArg(func))
    f.write(code % {
          'prefix' : _prefix,
          'name': func.name,
          'args': ", ".join(gl_arg_strings),
          'cmd_args': ", ".join(cmd_arg_strings),
        })
def WriteGLES2ImplementationUnitTest ( self , func , f ) : code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  struct Cmds {
    cmds::%(name)s cmd;
  };
  typedef cmds::%(name)s::Result::Type ResultType;
  ResultType result = 0;
  Cmds expected;
  ExpectedMemoryInfo result1 = GetExpectedResultMemory(
      sizeof(uint32_t) + sizeof(ResultType));
  expected.cmd.Init(%(cmd_args)s, result1.id, result1.offset);
  EXPECT_CALL(*command_buffer(), OnFlush())
      .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1)))
      .RetiresOnSaturation();
  gl_->%(name)s(%(args)s, &result);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
  EXPECT_EQ(static_cast<ResultType>(1), result);
}
""" first_cmd_arg = func . GetCmdArgs ( ) [ 0 ] . GetValidNonCachedClientSideCmdArg ( func ) if not first_cmd_arg : return first_gl_arg = func . GetOriginalArgs ( ) [ 0 ] . GetValidNonCachedClientSideArg ( func ) cmd_arg_strings = [ first_cmd_arg ] for arg in func . GetCmdArgs ( ) [ 1 : - 2 ] : cmd_arg_strings . append ( arg . GetValidClientSideCmdArg ( func ) ) gl_arg_strings = [ first_gl_arg ] for arg in func . GetOriginalArgs ( ) [ 1 : - 1 ] : gl_arg_strings . append ( arg . GetValidClientSideArg ( func ) ) f . write ( code % { 'prefix' : _prefix , 'name' : func . name , 'args' : ", " . join ( gl_arg_strings ) , 'cmd_args' : ", " . join ( cmd_arg_strings ) , } )
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
"""Writes the GLES2 Implemention unit test."""
self
func
f