testing/variations/PRESUBMIT.py
def ValidateData(input_api, json_data, file_path, message_type):
  """Validates the format of a fieldtrial configuration.

  Args:
    input_api: An instance passed to presubmit scripts telling info about the
      changes.
    json_data: Parsed JSON object representing the fieldtrial config.
    file_path: String representing the path to the JSON file.
    message_type: Type of message from |output_api| to return in the case of
      errors/warnings.

  Returns:
    A list of |message_type| messages. In the case of all tests passing with no
    warnings/errors, this will return [].
  """

  def _CreateMessage(message_format, *args):
    return _CreateMalformedConfigMessage(message_type, file_path,
                                         message_format, *args)

  if not _IsFieldTrialSizeBelowLimitOnWindows(input_api, file_path):
    return [message_type(FIELDTRIAL_CONFIG_TOO_LONG_ERROR_MSG)]

  if not isinstance(json_data, dict):
    return _CreateMessage('Expecting dict')
  for (study, experiment_configs) in iter(json_data.items()):
    warnings = _ValidateEntry(study, experiment_configs, _CreateMessage)
    if warnings:
      return warnings

  return []
Validates the format of a fieldtrial configuration.

  Args:
    input_api: An instance passed to presubmit scripts telling info about the
      changes.
    json_data: Parsed JSON object representing the fieldtrial config.
    file_path: String representing the path to the JSON file.
    message_type: Type of message from |output_api| to return in the case of
      errors/warnings.

  Returns:
    A list of |message_type| messages. In the case of all tests passing with no
    warnings/errors, this will return [].
  
Validates the format of a fieldtrial configuration.
Validates the format of a fieldtrial configuration .
def ValidateData(input_api, json_data, file_path, message_type):
  def _CreateMessage(message_format, *args):
    return _CreateMalformedConfigMessage(message_type, file_path,
                                         message_format, *args)
  if not _IsFieldTrialSizeBelowLimitOnWindows(input_api, file_path):
    return [message_type(FIELDTRIAL_CONFIG_TOO_LONG_ERROR_MSG)]
  if not isinstance(json_data, dict):
    return _CreateMessage('Expecting dict')
  for (study, experiment_configs) in iter(json_data.items()):
    warnings = _ValidateEntry(study, experiment_configs, _CreateMessage)
    if warnings:
      return warnings
  return []
def ValidateData ( input_api , json_data , file_path , message_type ) : def _CreateMessage ( message_format , * args ) : return _CreateMalformedConfigMessage ( message_type , file_path , message_format , * args ) if not _IsFieldTrialSizeBelowLimitOnWindows ( input_api , file_path ) : return [ message_type ( FIELDTRIAL_CONFIG_TOO_LONG_ERROR_MSG ) ] if not isinstance ( json_data , dict ) : return _CreateMessage ( 'Expecting dict' ) for ( study , experiment_configs ) in iter ( json_data . items ( ) ) : warnings = _ValidateEntry ( study , experiment_configs , _CreateMessage ) if warnings : return warnings return [ ]
Validates the format of a fieldtrial configuration.
Validates the format of a fieldtrial configuration .
"""Validates the format of a fieldtrial configuration.

  Args:
    input_api: An instance passed to presubmit scripts telling info about the
      changes.
    json_data: Parsed JSON object representing the fieldtrial config.
    file_path: String representing the path to the JSON file.
    message_type: Type of message from |output_api| to return in the case of
      errors/warnings.

  Returns:
    A list of |message_type| messages. In the case of all tests passing with no
    warnings/errors, this will return [].
  """
A list of |message_type| messages. In the case of all tests passing with no
warnings/errors, this will return [].
A list of |message_type| messages . In the case of all tests passing with no warnings / errors this will return [] .
input_api
An instance passed to presubmit scripts telling info about the
changes.
An instance passed to presubmit scripts telling info about the changes .
json_data
Parsed JSON object representing the fieldtrial config.
Parsed JSON object representing the fieldtrial config .
file_path
String representing the path to the JSON file.
String representing the path to the JSON file .
message_type
Type of message from |output_api| to return in the case of
errors/warnings.
Type of message from |output_api| to return in the case of errors / warnings .