parameters: (self, local_path, device_path)
docstring: Pushes |local_path| to |device_path|.
  
      Works for files and directories. This method skips copying any paths in
      |test_data_paths| that already exist on the device with the same hash.
  
      All pushed files can be removed by calling RemovePushedFiles().
docstring_summary: Pushes |local_path| to |device_path|.
docstring_tokens: Pushes |local_path| to |device_path| .
function: def PushIfNeeded(self, local_path, device_path):
      """Pushes |local_path| to |device_path|.
  
      Works for files and directories. This method skips copying any paths in
      |test_data_paths| that already exist on the device with the same hash.
  
      All pushed files can be removed by calling RemovePushedFiles().
      """
      assert os.path.exists(local_path), 'Local path not found %s' % local_path
  
      if not self._md5sum_path:
        default_build_type = os.environ.get('BUILD_TYPE', 'Debug')
        md5sum_path = '%s/out/%s/md5sum_bin' % (CHROME_SRC, default_build_type)
        if not os.path.exists(md5sum_path):
          md5sum_path = '%s/out/Release/md5sum_bin' % (CHROME_SRC)
          if not os.path.exists(md5sum_path):
            print >> sys.stderr, 'Please build md5sum.'
            sys.exit(1)
        command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH)
        assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
        self._md5sum_path = md5sum_path
  
      self._pushed_files.append(device_path)
      hashes_on_device = _ComputeFileListHash(
          self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path))
      assert os.path.exists(local_path), 'Local path not found %s' % local_path
      hashes_on_host = _ComputeFileListHash(
          subprocess.Popen(
              '%s_host %s' % (self._md5sum_path, local_path),
              stdout=subprocess.PIPE, shell=True).stdout)
      if hashes_on_device == hashes_on_host:
        return
  
      # They don't match, so remove everything first and then create it.
      if os.path.isdir(local_path):
        self.RunShellCommand('rm -r %s' % device_path, timeout_time=2*60)
        self.RunShellCommand('mkdir -p %s' % device_path)
  
      # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout of
      # 60 seconds which isn't sufficient for a lot of users of this method.
      push_command = 'push %s %s' % (local_path, device_path)
      logging.info('>>> $' + push_command)
      output = self._adb.SendCommand(push_command, timeout_time=30*60)
      assert _HasAdbPushSucceeded(output)
function_tokens: def PushIfNeeded ( self , local_path , device_path ) : assert os . path . exists ( local_path ) , 'Local path not found %s' % local_path if not self . _md5sum_path : default_build_type = os . environ . get ( 'BUILD_TYPE' , 'Debug' ) md5sum_path = '%s/out/%s/md5sum_bin' % ( CHROME_SRC , default_build_type ) if not os . path . exists ( md5sum_path ) : md5sum_path = '%s/out/Release/md5sum_bin' % ( CHROME_SRC ) if not os . path . exists ( md5sum_path ) : print >> sys . stderr , 'Please build md5sum.' sys . exit ( 1 ) command = 'push %s %s' % ( md5sum_path , MD5SUM_DEVICE_PATH ) assert _HasAdbPushSucceeded ( self . _adb . SendCommand ( command ) ) self . _md5sum_path = md5sum_path self . _pushed_files . append ( device_path ) hashes_on_device = _ComputeFileListHash ( self . RunShellCommand ( MD5SUM_DEVICE_PATH + ' ' + device_path ) ) assert os . path . exists ( local_path ) , 'Local path not found %s' % local_path hashes_on_host = _ComputeFileListHash ( subprocess . Popen ( '%s_host %s' % ( self . _md5sum_path , local_path ) , stdout = subprocess . PIPE , shell = True ) . stdout ) if hashes_on_device == hashes_on_host : return # They don't match, so remove everything first and then create it. if os . path . isdir ( local_path ) : self . RunShellCommand ( 'rm -r %s' % device_path , timeout_time = 2 * 60 ) self . RunShellCommand ( 'mkdir -p %s' % device_path ) # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout of # 60 seconds which isn't sufficient for a lot of users of this method. push_command = 'push %s %s' % ( local_path , device_path ) logging . info ( '>>> $' + push_command ) output = self . _adb . SendCommand ( push_command , timeout_time = 30 * 60 ) assert _HasAdbPushSucceeded ( output )