third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/fuzz_main_run.py
def FuzzTemplate(template_path, resources_path):
    """Uses a template to return a test case that can be run as a web test.

    This functions reads the template in |template_path|, injects the necessary
    js files to run as a web test and fuzzes the template's parameters to
    generate a test case.

    Args:
      template_path: The path to the template that will be used to generate
          a new test case.
      resources_path: Path to the js files that need to be included.

    Returns:
      A string containing the test case.
    """
    print 'Generating test file based on {}'.format(template_path)

    # Read the template.
    template_file_handle = open(template_path)
    template_file_data = template_file_handle.read().decode('utf-8')
    template_file_handle.close()

    # Generate a test file based on the template.
    generated_test = test_case_fuzzer.GenerateTestFile(template_file_data)
    # Fuzz parameters.
    fuzzed_file_data = parameter_fuzzer.FuzzParameters(generated_test)

    # Add includes
    for (js_file_name, include_parameter) in JS_FILES_AND_PARAMETERS:
        # Read js file.
        js_file_handle = open(os.path.join(resources_path, js_file_name))
        js_file_data = js_file_handle.read().decode('utf-8')
        js_file_handle.close()

        js_file_data = (SCRIPT_PREFIX + js_file_data + SCRIPT_SUFFIX)

        fuzzed_file_data = FillInParameter(
            include_parameter,
            lambda data=js_file_data: data,
            fuzzed_file_data)

    return fuzzed_file_data.encode('utf-8')
Uses a template to return a test case that can be run as a web test.

    This functions reads the template in |template_path|, injects the necessary
    js files to run as a web test and fuzzes the template's parameters to
    generate a test case.

    Args:
      template_path: The path to the template that will be used to generate
          a new test case.
      resources_path: Path to the js files that need to be included.

    Returns:
      A string containing the test case.
    
Uses a template to return a test case that can be run as a web test.
This functions reads the template in |template_path|, injects the necessary
js files to run as a web test and fuzzes the template's parameters to
generate a test case.
Uses a template to return a test case that can be run as a web test . This functions reads the template in |template_path| injects the necessary js files to run as a web test and fuzzes the template ' s parameters to generate a test case .
def FuzzTemplate(template_path, resources_path):
    print 'Generating test file based on {}'.format(template_path)
    template_file_handle = open(template_path)
    template_file_data = template_file_handle.read().decode('utf-8')
    template_file_handle.close()
    generated_test = test_case_fuzzer.GenerateTestFile(template_file_data)
    fuzzed_file_data = parameter_fuzzer.FuzzParameters(generated_test)
    for (js_file_name, include_parameter) in JS_FILES_AND_PARAMETERS:
        js_file_handle = open(os.path.join(resources_path, js_file_name))
        js_file_data = js_file_handle.read().decode('utf-8')
        js_file_handle.close()
        js_file_data = (SCRIPT_PREFIX + js_file_data + SCRIPT_SUFFIX)
        fuzzed_file_data = FillInParameter(
            include_parameter,
            lambda data=js_file_data: data,
            fuzzed_file_data)
    return fuzzed_file_data.encode('utf-8')
def FuzzTemplate ( template_path , resources_path ) : print 'Generating test file based on {}' . format ( template_path ) template_file_handle = open ( template_path ) template_file_data = template_file_handle . read ( ) . decode ( 'utf-8' ) template_file_handle . close ( ) generated_test = test_case_fuzzer . GenerateTestFile ( template_file_data ) fuzzed_file_data = parameter_fuzzer . FuzzParameters ( generated_test ) for ( js_file_name , include_parameter ) in JS_FILES_AND_PARAMETERS : js_file_handle = open ( os . path . join ( resources_path , js_file_name ) ) js_file_data = js_file_handle . read ( ) . decode ( 'utf-8' ) js_file_handle . close ( ) js_file_data = ( SCRIPT_PREFIX + js_file_data + SCRIPT_SUFFIX ) fuzzed_file_data = FillInParameter ( include_parameter , lambda data = js_file_data : data , fuzzed_file_data ) return fuzzed_file_data . encode ( 'utf-8' )
Uses a template to return a test case that can be run as a web test.
Uses a template to return a test case that can be run as a web test .
"""Uses a template to return a test case that can be run as a web test.

    This functions reads the template in |template_path|, injects the necessary
    js files to run as a web test and fuzzes the template's parameters to
    generate a test case.

    Args:
      template_path: The path to the template that will be used to generate
          a new test case.
      resources_path: Path to the js files that need to be included.

    Returns:
      A string containing the test case.
    """ # Read the template. # Generate a test file based on the template. # Fuzz parameters. # Add includes # Read js file.
A string containing the test case.
A string containing the test case .
template_path
The path to the template that will be used to generate
a new test case.
The path to the template that will be used to generate a new test case .
resources_path
Path to the js files that need to be included.
Path to the js files that need to be included .