diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-27 20:43:42 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-27 20:43:42 +0000 |
commit | 071302929ab813f647e51253af4e885b33eab463 (patch) | |
tree | c29903ffa398a80d27065a0645eedd26efa27b0b | |
parent | 6e8d2385ceaf69588379b2cca7e14cd3f176c4a9 (diff) | |
download | chromium_src-071302929ab813f647e51253af4e885b33eab463.zip chromium_src-071302929ab813f647e51253af4e885b33eab463.tar.gz chromium_src-071302929ab813f647e51253af4e885b33eab463.tar.bz2 |
Fix python scripts in src/chrome/test/functional/
Make sure that:
- shebang is only present for executable files
- shebang is #!/usr/bin/env python
- __main__ is only present for executable files
- file's executable bit is coherent
Also fix EOF LF to be only one.
Minor python style fixes.
R=nirnimesh@chromium.org
BUG=105108
TEST=
Review URL: http://codereview.chromium.org/8676019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111657 0039d316-1c4b-4281-b951-d872f2087c98
106 files changed, 655 insertions, 670 deletions
diff --git a/chrome/test/functional/autofill.py b/chrome/test/functional/autofill.py index 2166665..22036a0 100644..100755 --- a/chrome/test/functional/autofill.py +++ b/chrome/test/functional/autofill.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/autofill_dataset_converter.py b/chrome/test/functional/autofill_dataset_converter.py index f3f2bea..3a350d4 100644..100755 --- a/chrome/test/functional/autofill_dataset_converter.py +++ b/chrome/test/functional/autofill_dataset_converter.py @@ -1,227 +1,227 @@ -#!/usr/bin/python
-
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Converts profile datasets to dictionary list for Autofill profiles.
-
-Used for test autofill.AutofillTest.testMergeDuplicateProfilesInAutofill.
-Can be used as a stand alone script with -h to print out help text by running:
-python autofill_dataset_converter.py -h
-"""
-
-import codecs
-import logging
-import os
-import re
-import sys
-
-
-class _NullHandler(logging.Handler):
- """Prevents warning when running in quiet mode."""
- def emit(self, record):
- pass
-
-
-class DatasetConverter(object):
- _fields = [
- u'NAME_FIRST',
- u'NAME_MIDDLE',
- u'NAME_LAST',
- u'EMAIL_ADDRESS',
- u'COMPANY_NAME',
- u'ADDRESS_HOME_LINE1',
- u'ADDRESS_HOME_LINE2',
- u'ADDRESS_HOME_CITY',
- u'ADDRESS_HOME_STATE',
- u'ADDRESS_HOME_ZIP',
- u'ADDRESS_HOME_COUNTRY',
- u'PHONE_HOME_WHOLE_NUMBER',
- ]
- _record_length = len(_fields)
- _output_pattern = u'{'
- for key in _fields:
- _output_pattern += u"u'%s': u'%%s', " % key
- _output_pattern = _output_pattern[:-1] + '},'
- _re_single_quote = re.compile("'", re.UNICODE)
- _logger = logging.getLogger(__name__)
- _logger.addHandler(_NullHandler())
- _log_handlers = {'StreamHandler': None}
-
- def __init__(self, input_filename, output_filename=None,
- logging_level=None):
- """Constructs a dataset converter object.
-
- Full input pattern:
- '(?P<NAME_FIRST>.*?)\|(?P<MIDDLE_NAME>.*?)\|(?P<NAME_LAST>.*?)\|
- (?P<EMAIL_ADDRESS>.*?)\|(?P<COMPANY_NAME>.*?)\|(?P<ADDRESS_HOME_LINE1>.*?)
- \|(?P<ADDRESS_HOME_LINE2>.*?)\|(?P<ADDRESS_HOME_CITY>.*?)\|
- (?P<ADDRESS_HOME_STATE>.*?)\|(?P<ADDRESS_HOME_ZIP>.*?)\|
- (?P<ADDRESS_HOME_COUNTRY>.*?)\|(?P<PHONE_HOME_WHOLE_NUMBER>.*?)$'
-
- Full ouput pattern:
- "{u'NAME_FIRST': u'%s', u'NAME_MIDDLE': u'%s', u'NAME_LAST': u'%s',
- u'EMAIL_ADDRESS': u'%s', u'COMPANY_NAME': u'%s', u'ADDRESS_HOME_LINE1':
- u'%s', u'ADDRESS_HOME_LINE2': u'%s', u'ADDRESS_HOME_CITY': u'%s',
- u'ADDRESS_HOME_STATE': u'%s', u'ADDRESS_HOME_ZIP': u'%s',
- u'ADDRESS_HOME_COUNTRY': u'%s', u'PHONE_HOME_WHOLE_NUMBER': u'%s',},"
-
- Args:
- input_filename: name and path of the input dataset.
- output_filename: name and path of the converted file, default is none.
- logging_level: set verbosity levels, default is ERROR.
-
- Raises:
- IOError: error if input file does not exist.
- """
- if logging_level:
- if not self._log_handlers['StreamHandler']:
- console = logging.StreamHandler()
- console.setLevel(logging_level)
- self._log_handlers['StreamHandler'] = console
- self._logger.addHandler(console)
- self._logger.setLevel(logging_level)
- else:
- if self._log_handlers['StreamHandler']:
- self._logger.removeHandler(self._log_handlers['StreamHandler'])
- self._log_handler['StreamHandler'] = None
-
- self._input_filename = os.path.join(os.path.dirname(sys.argv[0]),
- input_filename)
- if not os.path.isfile(self._input_filename):
- msg = 'File "%s" does not exist' % self._input_filename
- self._logger.error(msg)
- raise IOError(msg)
- self._output_filename = output_filename
-
- def _CreateDictionaryFromRecord(self, record):
- """Constructs and returns a dictionary from a record in the dataset file.
-
- Escapes single quotation first and uses split('|') to separate values.
- The method assumes a valid record always contains at least one "|"
- character.
- Example:
- Take an argument as a string u'John|Doe|Mountain View'
- and returns a dictionary
- {
- u'NAME_FIRST': u'John',
- u'NAME_LAST': u'Doe',
- u'ADDRESS_HOME_CITY': u'Mountain View',
- }
-
- Args:
- record: row of record from the dataset file.
-
- Returns:
- None if the current record line is invalid or a dictionary representing a
- single record from the dataset file.
- """
- # Ignore irrelevant record lines that do not contain '|'.
- if not '|' in record:
- return
- # Escaping single quote: "'" -> "\'"
- record = self._re_single_quote.sub(r"\'", record)
- record_list = record.split('|')
- if record_list:
- # Check for case when a record may have more or less fields than expected.
- if len(record_list) != self._record_length:
- self._logger.warning(
- 'A "|" separated line has %d fields instead of %d: %s' % (
- len(record_list), self._record_length, record))
- return
- out_record = {}
- for i, key in enumerate(self._fields):
- out_record[key] = record_list[i]
- return out_record
-
- def Convert(self):
- """Function to convert input data into the desired output format.
-
- Returns:
- List that holds all the dictionaries.
- """
- input_file = open(self._input_filename)
- if self._output_filename:
- output_file = codecs.open(self._output_filename, mode='wb',
- encoding='utf-8-sig')
- else:
- output_file = None
- try:
- list_of_dict = []
- i = 0
- if output_file:
- output_file.write('[')
- output_file.write(os.linesep)
- for line in input_file.readlines():
- line = line.strip()
- if not line:
- continue
- line = unicode(line, 'UTF-8')
- output_record = self._CreateDictionaryFromRecord(line)
- if output_record:
- i += 1
- list_of_dict.append(output_record)
- output_line = self._output_pattern % tuple(
- [output_record[key] for key in self._fields])
- if output_file:
- output_file.write(output_line)
- output_file.write(os.linesep)
- self._logger.info('%d: %s' % (i, line.encode('UTF-8')))
- self._logger.info('\tconverted to: %s' % output_line.encode('UTF-8'))
- if output_file:
- output_file.write(']')
- output_file.write(os.linesep)
- self._logger.info('%d lines converted SUCCESSFULLY!' % i)
- self._logger.info('--- FINISHED ---')
- return list_of_dict
- finally:
- if output_file:
- output_file.close()
-
-
-def main():
- # Command line options.
- from optparse import OptionParser
- input_filename = os.path.join('..', 'data', 'autofill', 'dataset.txt')
- output_filename = os.path.join('..', 'data', 'autofill',
- 'dataset_duplicate-profiles.txt')
- parser = OptionParser()
- parser.add_option('-i', '--input', dest='input_filename',
- default=input_filename,
- help='convert FILE [defaults to "%s"]' % input_filename,
- metavar='FILE')
- parser.add_option('-o', '--output', dest='output_filename',
- default=output_filename,
- help='write output to FILE [defaults to "%s"]' %
- output_filename, metavar='FILE')
- parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
- default=True, help='display all [default]')
- parser.add_option('-q', '--quiet', action='store_false', dest='verbose',
- help='display nothing')
- parser.add_option('-l', '--log', dest='logging_level', default=None,
- help='specify logging LEVEL: "info", "warning" or "error"',
- metavar='LEVEL')
-
- (options, args) = parser.parse_args()
- if args:
- parser.print_help()
- sys.exit(1)
- if not options.verbose:
- options.logging_level = None
- if options.verbose and not options.logging_level:
- options.logging_level = 'info'
- if options.logging_level:
- if 'info' in options.logging_level.lower():
- options.logging_level = logging.INFO
- elif 'warn' in options.logging_level.lower():
- options.logging_level = logging.WARNING
- elif 'error' in options.logging_level.lower():
- options.logging_level = logging.ERROR
-
- c = DatasetConverter(options.input_filename, options.output_filename,
- options.logging_level)
- c.Convert()
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Converts profile datasets to dictionary list for Autofill profiles. + +Used for test autofill.AutofillTest.testMergeDuplicateProfilesInAutofill. +Can be used as a stand alone script with -h to print out help text by running: +python autofill_dataset_converter.py -h +""" + +import codecs +import logging +import os +import re +import sys + + +class _NullHandler(logging.Handler): + """Prevents warning when running in quiet mode.""" + def emit(self, record): + pass + + +class DatasetConverter(object): + _fields = [ + u'NAME_FIRST', + u'NAME_MIDDLE', + u'NAME_LAST', + u'EMAIL_ADDRESS', + u'COMPANY_NAME', + u'ADDRESS_HOME_LINE1', + u'ADDRESS_HOME_LINE2', + u'ADDRESS_HOME_CITY', + u'ADDRESS_HOME_STATE', + u'ADDRESS_HOME_ZIP', + u'ADDRESS_HOME_COUNTRY', + u'PHONE_HOME_WHOLE_NUMBER', + ] + _record_length = len(_fields) + _output_pattern = u'{' + for key in _fields: + _output_pattern += u"u'%s': u'%%s', " % key + _output_pattern = _output_pattern[:-1] + '},' + _re_single_quote = re.compile("'", re.UNICODE) + _logger = logging.getLogger(__name__) + _logger.addHandler(_NullHandler()) + _log_handlers = {'StreamHandler': None} + + def __init__(self, input_filename, output_filename=None, + logging_level=None): + """Constructs a dataset converter object. + + Full input pattern: + '(?P<NAME_FIRST>.*?)\|(?P<MIDDLE_NAME>.*?)\|(?P<NAME_LAST>.*?)\| + (?P<EMAIL_ADDRESS>.*?)\|(?P<COMPANY_NAME>.*?)\|(?P<ADDRESS_HOME_LINE1>.*?) + \|(?P<ADDRESS_HOME_LINE2>.*?)\|(?P<ADDRESS_HOME_CITY>.*?)\| + (?P<ADDRESS_HOME_STATE>.*?)\|(?P<ADDRESS_HOME_ZIP>.*?)\| + (?P<ADDRESS_HOME_COUNTRY>.*?)\|(?P<PHONE_HOME_WHOLE_NUMBER>.*?)$' + + Full ouput pattern: + "{u'NAME_FIRST': u'%s', u'NAME_MIDDLE': u'%s', u'NAME_LAST': u'%s', + u'EMAIL_ADDRESS': u'%s', u'COMPANY_NAME': u'%s', u'ADDRESS_HOME_LINE1': + u'%s', u'ADDRESS_HOME_LINE2': u'%s', u'ADDRESS_HOME_CITY': u'%s', + u'ADDRESS_HOME_STATE': u'%s', u'ADDRESS_HOME_ZIP': u'%s', + u'ADDRESS_HOME_COUNTRY': u'%s', u'PHONE_HOME_WHOLE_NUMBER': u'%s',}," + + Args: + input_filename: name and path of the input dataset. + output_filename: name and path of the converted file, default is none. + logging_level: set verbosity levels, default is ERROR. + + Raises: + IOError: error if input file does not exist. + """ + if logging_level: + if not self._log_handlers['StreamHandler']: + console = logging.StreamHandler() + console.setLevel(logging_level) + self._log_handlers['StreamHandler'] = console + self._logger.addHandler(console) + self._logger.setLevel(logging_level) + else: + if self._log_handlers['StreamHandler']: + self._logger.removeHandler(self._log_handlers['StreamHandler']) + self._log_handler['StreamHandler'] = None + + self._input_filename = os.path.join(os.path.dirname(sys.argv[0]), + input_filename) + if not os.path.isfile(self._input_filename): + msg = 'File "%s" does not exist' % self._input_filename + self._logger.error(msg) + raise IOError(msg) + self._output_filename = output_filename + + def _CreateDictionaryFromRecord(self, record): + """Constructs and returns a dictionary from a record in the dataset file. + + Escapes single quotation first and uses split('|') to separate values. + The method assumes a valid record always contains at least one "|" + character. + Example: + Take an argument as a string u'John|Doe|Mountain View' + and returns a dictionary + { + u'NAME_FIRST': u'John', + u'NAME_LAST': u'Doe', + u'ADDRESS_HOME_CITY': u'Mountain View', + } + + Args: + record: row of record from the dataset file. + + Returns: + None if the current record line is invalid or a dictionary representing a + single record from the dataset file. + """ + # Ignore irrelevant record lines that do not contain '|'. + if not '|' in record: + return + # Escaping single quote: "'" -> "\'" + record = self._re_single_quote.sub(r"\'", record) + record_list = record.split('|') + if record_list: + # Check for case when a record may have more or less fields than expected. + if len(record_list) != self._record_length: + self._logger.warning( + 'A "|" separated line has %d fields instead of %d: %s' % ( + len(record_list), self._record_length, record)) + return + out_record = {} + for i, key in enumerate(self._fields): + out_record[key] = record_list[i] + return out_record + + def Convert(self): + """Function to convert input data into the desired output format. + + Returns: + List that holds all the dictionaries. + """ + input_file = open(self._input_filename) + if self._output_filename: + output_file = codecs.open(self._output_filename, mode='wb', + encoding='utf-8-sig') + else: + output_file = None + try: + list_of_dict = [] + i = 0 + if output_file: + output_file.write('[') + output_file.write(os.linesep) + for line in input_file.readlines(): + line = line.strip() + if not line: + continue + line = unicode(line, 'UTF-8') + output_record = self._CreateDictionaryFromRecord(line) + if output_record: + i += 1 + list_of_dict.append(output_record) + output_line = self._output_pattern % tuple( + [output_record[key] for key in self._fields]) + if output_file: + output_file.write(output_line) + output_file.write(os.linesep) + self._logger.info('%d: %s' % (i, line.encode('UTF-8'))) + self._logger.info('\tconverted to: %s' % output_line.encode('UTF-8')) + if output_file: + output_file.write(']') + output_file.write(os.linesep) + self._logger.info('%d lines converted SUCCESSFULLY!' % i) + self._logger.info('--- FINISHED ---') + return list_of_dict + finally: + if output_file: + output_file.close() + + +def main(): + from optparse import OptionParser + input_filename = os.path.join('..', 'data', 'autofill', 'dataset.txt') + output_filename = os.path.join('..', 'data', 'autofill', + 'dataset_duplicate-profiles.txt') + parser = OptionParser() + parser.add_option('-i', '--input', dest='input_filename', + default=input_filename, + help='convert FILE [defaults to "%s"]' % input_filename, + metavar='FILE') + parser.add_option('-o', '--output', dest='output_filename', + default=output_filename, + help='write output to FILE [defaults to "%s"]' % + output_filename, metavar='FILE') + parser.add_option('-v', '--verbose', action='store_true', dest='verbose', + default=True, help='display all [default]') + parser.add_option('-q', '--quiet', action='store_false', dest='verbose', + help='display nothing') + parser.add_option('-l', '--log', dest='logging_level', default=None, + help='specify logging LEVEL: "info", "warning" or "error"', + metavar='LEVEL') + + (options, args) = parser.parse_args() + if args: + parser.print_help() + return 1 + if not options.verbose: + options.logging_level = None + if options.verbose and not options.logging_level: + options.logging_level = 'info' + if options.logging_level: + if 'info' in options.logging_level.lower(): + options.logging_level = logging.INFO + elif 'warn' in options.logging_level.lower(): + options.logging_level = logging.WARNING + elif 'error' in options.logging_level.lower(): + options.logging_level = logging.ERROR + + c = DatasetConverter(options.input_filename, options.output_filename, + options.logging_level) + c.Convert() + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/chrome/test/functional/autofill_dataset_generator.py b/chrome/test/functional/autofill_dataset_generator.py index d73ca9f..6e882ef 100644..100755 --- a/chrome/test/functional/autofill_dataset_generator.py +++ b/chrome/test/functional/autofill_dataset_generator.py @@ -1,307 +1,307 @@ -#!/usr/bin/python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Generates profile dictionaries for Autofill.
-
-Used to test autofill.AutofillTest.FormFillLatencyAfterSubmit.
-Can be used as a stand alone script with -h to print out help text by running:
- python autofill_dataset_generator.py -h
-"""
-
-import codecs
-import logging
-from optparse import OptionParser
-import os
-import random
-import re
-import sys
-
-
-class NullHandler(logging.Handler):
- def emit(self, record):
- pass
-
-
-class DatasetGenerator(object):
- """Generates a dataset of dictionaries.
-
- The lists (such as address_construct, city_construct) define the way the
- corresponding field is generated. They accomplish this by specifying a
- list of function-args lists.
- """
- address_construct = [
- [ random.randint, 1, 10000],
- [ None, u'foobar'],
- [ random.choice, [ u'St', u'Ave', u'Ln', u'Ct', ]],
- [ random.choice, [ u'#1', u'#2', u'#3', ]],
- ]
-
- city_construct = [
- [ random.choice, [ u'San Jose', u'San Francisco', u'Sacramento',
- u'Los Angeles', ]],
- ]
-
- state_construct = [
- [ None, u'CA']
- ]
-
- # These zip codes are now matched to the corresponding cities in
- # city_construct.
- zip_construct = [ u'95110', u'94109', u'94203', u'90120']
-
- logger = logging.getLogger(__name__)
- logger.addHandler(NullHandler())
- log_handlers = {'StreamHandler': None}
-
- def __init__(self, output_filename=None, logging_level=None):
- """Constructs dataset generator object.
-
- Creates 'fields' data member which is a list of pair (two values) lists.
- These pairs are comprised of a field key e.g. u'NAME_FIRST' and a
- generator method e.g. self.GenerateNameFirst which will generate the value.
- If we want the value to always be the same e.g. u'John' we can use this
- instead of a method. We can even use None keyword which will give
- a value of u''.
-
- 'output_pattern' for one field would have been: "{u'NAME_FIRST': u'%s',}"
- which is ready to accept a value for the 'NAME_FIRST' field key once
- this value is generated.
- 'output_pattern' is used in 'GenerateNextDict()' to generate the next
- dict line.
-
- Args:
- output_filename: specified filename of generated dataset to be saved.
- Default value is None and no saving takes place.
- logging_level: set verbosity levels, default is None.
- """
- if logging_level:
- if not self.log_handlers['StreamHandler']:
- console = logging.StreamHandler()
- console.setLevel(logging.INFO)
- self.log_handlers['StreamHandler'] = console
- self.logger.addHandler(console)
- self.logger.setLevel(logging_level)
- else:
- if self.log_handlers['StreamHandler']:
- self.logger.removeHandler(self.log_handlers['StreamHandler'])
- self.log_handlers['StreamHandler'] = None
-
- self.output_filename = output_filename
-
- self.dict_no = 0
- self.fields = [
- [u'NAME_FIRST', self.GenerateNameFirst],
- [u'NAME_MIDDLE', None],
- [u'NAME_LAST', None],
- [u'EMAIL_ADDRESS', self.GenerateEmail],
- [u'COMPANY_NAME', None],
- [u'ADDRESS_HOME_LINE1', self.GenerateAddress],
- [u'ADDRESS_HOME_LINE2', None],
- [u'ADDRESS_HOME_CITY', self.GenerateCity],
- [u'ADDRESS_HOME_STATE', self.GenerateState],
- [u'ADDRESS_HOME_ZIP', self.GenerateZip],
- [u'ADDRESS_HOME_COUNTRY', u'United States'],
- [u'PHONE_HOME_WHOLE_NUMBER', None],
- ]
-
- self.next_dict = {}
- # Using implicit line joining does not work well in this case as each line
- # has to be strings and not function calls that may return strings.
- self.output_pattern = u'{\'' + \
- u', '.join([u'u"%s" : u"%%s"' % key for key, method in self.fields]) + \
- u',}'
-
- def _GenerateField(self, field_construct):
- """Generates each field in each dictionary.
-
- Args:
- field_construct: it is a list of lists.
- The first value (index 0) of each containing list is a function or None.
- The remaining values are the args. If function is None then arg is just
- returned.
-
- Example 1: zip_construct = [[ None, u'95110']]. There is one
- containing list only and function here is None and arg is u'95110'.
- This just returns u'95110'.
-
- Example 2: address_construct = [ [ random.randint, 1, 10000],
- [ None, u'foobar'] ] This has two containing lists and it will return
- the result of:
- random.randint(1, 10000) + ' ' + u'foobar'
- which could be u'7832 foobar'
- """
- parts = []
- for function_and_args in field_construct:
- function = function_and_args[0]
- args = function_and_args[1:]
- if not function:
- function = lambda x: x
- parts.append(str(function(*args)))
- return (' ').join(parts)
-
- def GenerateAddress(self):
- """Uses _GenerateField() and address_construct to gen a random address.
-
- Returns:
- A random address.
- """
- return self._GenerateField(self.address_construct)
-
- def GenerateCity(self):
- """Uses _GenerateField() and city_construct to gen a random city.
-
- Returns:
- A random city.
- """
- return self._GenerateField(self.city_construct)
-
- def GenerateState(self):
- """Uses _GenerateField() and state_construct to generate a state.
-
- Returns:
- A state.
- """
- return self._GenerateField(self.state_construct)
-
- def GenerateZip(self):
- """Uses zip_construct and generated cities to return a matched zip code.
-
- Returns:
- A zip code matched to the corresponding city.
- """
- city_selected = self.next_dict['ADDRESS_HOME_CITY'][0]
- index = self.city_construct[0][1].index(city_selected)
- return self.zip_construct[index]
-
- def GenerateCountry(self):
- """Uses _GenerateField() and country_construct to generate a country.
-
- Returns:
- A country.
- """
- return self._GenerateField(self.country_construct)
-
- def GenerateNameFirst(self):
- """Generates a numerical first name.
-
- The name is the number of the current dict.
- i.e. u'1', u'2', u'3'
-
- Returns:
- A numerical first name.
- """
- return u'%s' % self.dict_no
-
- def GenerateEmail(self):
- """Generates an email that corresponds to the first name.
-
- i.e. u'1@example.com', u'2@example.com', u'3@example.com'
-
- Returns:
- An email address that corresponds to the first name.
- """
- return u'%s@example.com' % self.dict_no
-
-
- def GenerateNextDict(self):
- """Generates next dictionary of the dataset.
-
- Returns:
- The output dictionary.
- """
- self.dict_no += 1
- self.next_dict = {}
- for key, method_or_value in self.fields:
- if not method_or_value:
- self.next_dict[key] = ['']
- elif type(method_or_value) in [str, unicode]:
- self.next_dict[key] = ['%s' % method_or_value]
- else:
- self.next_dict[key] = [method_or_value()]
- return self.next_dict
-
- def GenerateDataset(self, num_of_dict_to_generate=10):
- """Generates a list of dictionaries.
-
- Args:
- num_of_dict_to_generate: The number of dictionaries to be generated.
- Default value is 10.
-
- Returns:
- The dictionary list.
- """
- random.seed(0) # All randomly generated values are reproducible.
- if self.output_filename:
- output_file = codecs.open(
- self.output_filename, mode='wb', encoding='utf-8-sig')
- else:
- output_file = None
- try:
- list_of_dict = []
- if output_file:
- output_file.write('[')
- output_file.write(os.linesep)
-
- while self.dict_no < num_of_dict_to_generate:
- output_dict = self.GenerateNextDict()
- list_of_dict.append(output_dict)
- output_line = self.output_pattern % tuple(
- [output_dict[key] for key, method in self.fields])
- if output_file:
- output_file.write(output_line)
- output_file.write(os.linesep)
- self.logger.info(
- '%d: [%s]' % (self.dict_no, output_line.encode(sys.stdout.encoding,
- 'ignore')))
-
- if output_file:
- output_file.write(']')
- output_file.write(os.linesep)
- self.logger.info('%d dictionaries generated SUCCESSFULLY!', self.dict_no)
- self.logger.info('--- FINISHED ---')
- return list_of_dict
- finally:
- if output_file:
- output_file.close()
-
-
-def main():
- # Command line options.
- parser = OptionParser()
- parser.add_option(
- '-o', '--output', dest='output_filename', default='',
- help='write output to FILE [optional]', metavar='FILE')
- parser.add_option(
- '-d', '--dict', type='int', dest='dict_no', metavar='DICT_NO', default=10,
- help='DICT_NO: number of dictionaries to be generated [default: %default]')
- parser.add_option(
- '-l', '--log_level', dest='log_level', default='debug',
- metavar='LOG_LEVEL',
- help='LOG_LEVEL: "debug", "info", "warning" or "error" [default: %default]')
-
- (options, args) = parser.parse_args()
- if args:
- parser.print_help()
- sys.exit(1)
- options.log_level = options.log_level.lower()
- if options.log_level not in ['debug', 'info', 'warning', 'error']:
- parser.error('Wrong log_level argument.')
- parser.print_help()
- else:
- if options.log_level == 'debug':
- options.log_level = logging.DEBUG
- elif options.log_level == 'info':
- options.log_level = logging.INFO
- elif options.log_level == 'warning':
- options.log_level = logging.WARNING
- elif options.log_level == 'error':
- options.log_level = logging.ERROR
-
- gen = DatasetGenerator(options.output_filename, options.log_level)
- gen.GenerateDataset(options.dict_no)
-
-
-if __name__ == '__main__':
- main()
+#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generates profile dictionaries for Autofill. + +Used to test autofill.AutofillTest.FormFillLatencyAfterSubmit. +Can be used as a stand alone script with -h to print out help text by running: + python autofill_dataset_generator.py -h +""" + +import codecs +import logging +from optparse import OptionParser +import os +import random +import re +import sys + + +class NullHandler(logging.Handler): + def emit(self, record): + pass + + +class DatasetGenerator(object): + """Generates a dataset of dictionaries. + + The lists (such as address_construct, city_construct) define the way the + corresponding field is generated. They accomplish this by specifying a + list of function-args lists. + """ + address_construct = [ + [ random.randint, 1, 10000], + [ None, u'foobar'], + [ random.choice, [ u'St', u'Ave', u'Ln', u'Ct', ]], + [ random.choice, [ u'#1', u'#2', u'#3', ]], + ] + + city_construct = [ + [ random.choice, [ u'San Jose', u'San Francisco', u'Sacramento', + u'Los Angeles', ]], + ] + + state_construct = [ + [ None, u'CA'] + ] + + # These zip codes are now matched to the corresponding cities in + # city_construct. + zip_construct = [ u'95110', u'94109', u'94203', u'90120'] + + logger = logging.getLogger(__name__) + logger.addHandler(NullHandler()) + log_handlers = {'StreamHandler': None} + + def __init__(self, output_filename=None, logging_level=None): + """Constructs dataset generator object. + + Creates 'fields' data member which is a list of pair (two values) lists. + These pairs are comprised of a field key e.g. u'NAME_FIRST' and a + generator method e.g. self.GenerateNameFirst which will generate the value. + If we want the value to always be the same e.g. u'John' we can use this + instead of a method. We can even use None keyword which will give + a value of u''. + + 'output_pattern' for one field would have been: "{u'NAME_FIRST': u'%s',}" + which is ready to accept a value for the 'NAME_FIRST' field key once + this value is generated. + 'output_pattern' is used in 'GenerateNextDict()' to generate the next + dict line. + + Args: + output_filename: specified filename of generated dataset to be saved. + Default value is None and no saving takes place. + logging_level: set verbosity levels, default is None. + """ + if logging_level: + if not self.log_handlers['StreamHandler']: + console = logging.StreamHandler() + console.setLevel(logging.INFO) + self.log_handlers['StreamHandler'] = console + self.logger.addHandler(console) + self.logger.setLevel(logging_level) + else: + if self.log_handlers['StreamHandler']: + self.logger.removeHandler(self.log_handlers['StreamHandler']) + self.log_handlers['StreamHandler'] = None + + self.output_filename = output_filename + + self.dict_no = 0 + self.fields = [ + [u'NAME_FIRST', self.GenerateNameFirst], + [u'NAME_MIDDLE', None], + [u'NAME_LAST', None], + [u'EMAIL_ADDRESS', self.GenerateEmail], + [u'COMPANY_NAME', None], + [u'ADDRESS_HOME_LINE1', self.GenerateAddress], + [u'ADDRESS_HOME_LINE2', None], + [u'ADDRESS_HOME_CITY', self.GenerateCity], + [u'ADDRESS_HOME_STATE', self.GenerateState], + [u'ADDRESS_HOME_ZIP', self.GenerateZip], + [u'ADDRESS_HOME_COUNTRY', u'United States'], + [u'PHONE_HOME_WHOLE_NUMBER', None], + ] + + self.next_dict = {} + # Using implicit line joining does not work well in this case as each line + # has to be strings and not function calls that may return strings. + self.output_pattern = u'{\'' + \ + u', '.join([u'u"%s" : u"%%s"' % key for key, method in self.fields]) + \ + u',}' + + def _GenerateField(self, field_construct): + """Generates each field in each dictionary. + + Args: + field_construct: it is a list of lists. + The first value (index 0) of each containing list is a function or None. + The remaining values are the args. If function is None then arg is just + returned. + + Example 1: zip_construct = [[ None, u'95110']]. There is one + containing list only and function here is None and arg is u'95110'. + This just returns u'95110'. + + Example 2: address_construct = [ [ random.randint, 1, 10000], + [ None, u'foobar'] ] This has two containing lists and it will return + the result of: + random.randint(1, 10000) + ' ' + u'foobar' + which could be u'7832 foobar' + """ + parts = [] + for function_and_args in field_construct: + function = function_and_args[0] + args = function_and_args[1:] + if not function: + function = lambda x: x + parts.append(str(function(*args))) + return (' ').join(parts) + + def GenerateAddress(self): + """Uses _GenerateField() and address_construct to gen a random address. + + Returns: + A random address. + """ + return self._GenerateField(self.address_construct) + + def GenerateCity(self): + """Uses _GenerateField() and city_construct to gen a random city. + + Returns: + A random city. + """ + return self._GenerateField(self.city_construct) + + def GenerateState(self): + """Uses _GenerateField() and state_construct to generate a state. + + Returns: + A state. + """ + return self._GenerateField(self.state_construct) + + def GenerateZip(self): + """Uses zip_construct and generated cities to return a matched zip code. + + Returns: + A zip code matched to the corresponding city. + """ + city_selected = self.next_dict['ADDRESS_HOME_CITY'][0] + index = self.city_construct[0][1].index(city_selected) + return self.zip_construct[index] + + def GenerateCountry(self): + """Uses _GenerateField() and country_construct to generate a country. + + Returns: + A country. + """ + return self._GenerateField(self.country_construct) + + def GenerateNameFirst(self): + """Generates a numerical first name. + + The name is the number of the current dict. + i.e. u'1', u'2', u'3' + + Returns: + A numerical first name. + """ + return u'%s' % self.dict_no + + def GenerateEmail(self): + """Generates an email that corresponds to the first name. + + i.e. u'1@example.com', u'2@example.com', u'3@example.com' + + Returns: + An email address that corresponds to the first name. + """ + return u'%s@example.com' % self.dict_no + + + def GenerateNextDict(self): + """Generates next dictionary of the dataset. + + Returns: + The output dictionary. + """ + self.dict_no += 1 + self.next_dict = {} + for key, method_or_value in self.fields: + if not method_or_value: + self.next_dict[key] = [''] + elif type(method_or_value) in [str, unicode]: + self.next_dict[key] = ['%s' % method_or_value] + else: + self.next_dict[key] = [method_or_value()] + return self.next_dict + + def GenerateDataset(self, num_of_dict_to_generate=10): + """Generates a list of dictionaries. + + Args: + num_of_dict_to_generate: The number of dictionaries to be generated. + Default value is 10. + + Returns: + The dictionary list. + """ + random.seed(0) # All randomly generated values are reproducible. + if self.output_filename: + output_file = codecs.open( + self.output_filename, mode='wb', encoding='utf-8-sig') + else: + output_file = None + try: + list_of_dict = [] + if output_file: + output_file.write('[') + output_file.write(os.linesep) + + while self.dict_no < num_of_dict_to_generate: + output_dict = self.GenerateNextDict() + list_of_dict.append(output_dict) + output_line = self.output_pattern % tuple( + [output_dict[key] for key, method in self.fields]) + if output_file: + output_file.write(output_line) + output_file.write(os.linesep) + self.logger.info( + '%d: [%s]' % (self.dict_no, output_line.encode(sys.stdout.encoding, + 'ignore'))) + + if output_file: + output_file.write(']') + output_file.write(os.linesep) + self.logger.info('%d dictionaries generated SUCCESSFULLY!', self.dict_no) + self.logger.info('--- FINISHED ---') + return list_of_dict + finally: + if output_file: + output_file.close() + + +def main(): + parser = OptionParser() + parser.add_option( + '-o', '--output', dest='output_filename', default='', + help='write output to FILE [optional]', metavar='FILE') + parser.add_option( + '-d', '--dict', type='int', dest='dict_no', metavar='DICT_NO', default=10, + help='DICT_NO: number of dictionaries to be generated [default: %default]') + parser.add_option( + '-l', '--log_level', dest='log_level', default='debug', + metavar='LOG_LEVEL', + help='LOG_LEVEL: "debug", "info", "warning" or "error" [default: %default]') + + (options, args) = parser.parse_args() + if args: + parser.print_help() + return 1 + options.log_level = options.log_level.lower() + if options.log_level not in ['debug', 'info', 'warning', 'error']: + parser.error('Wrong log_level argument.') + parser.print_help() + else: + if options.log_level == 'debug': + options.log_level = logging.DEBUG + elif options.log_level == 'info': + options.log_level = logging.INFO + elif options.log_level == 'warning': + options.log_level = logging.WARNING + elif options.log_level == 'error': + options.log_level = logging.ERROR + + gen = DatasetGenerator(options.output_filename, options.log_level) + gen.GenerateDataset(options.dict_no) + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/chrome/test/functional/bookmark_bar.py b/chrome/test/functional/bookmark_bar.py index 002f0e4..141a4c3 100644..100755 --- a/chrome/test/functional/bookmark_bar.py +++ b/chrome/test/functional/bookmark_bar.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/bookmarks.py b/chrome/test/functional/bookmarks.py index fc8745b..a3ee157 100644..100755 --- a/chrome/test/functional/bookmarks.py +++ b/chrome/test/functional/bookmarks.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/browser.py b/chrome/test/functional/browser.py index fadf5f450..30dc74e 100644..100755 --- a/chrome/test/functional/browser.py +++ b/chrome/test/functional/browser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/browsing_data.py b/chrome/test/functional/browsing_data.py index 1e0a805..ad0a341 100644..100755 --- a/chrome/test/functional/browsing_data.py +++ b/chrome/test/functional/browsing_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_basic.py b/chrome/test/functional/chromeos_basic.py index df8e99b..1071741 100644..100755 --- a/chrome/test/functional/chromeos_basic.py +++ b/chrome/test/functional/chromeos_basic.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_battery.py b/chrome/test/functional/chromeos_battery.py index 94bbcd7..1fd613b 100644..100755 --- a/chrome/test/functional/chromeos_battery.py +++ b/chrome/test/functional/chromeos_battery.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_browser.py b/chrome/test/functional/chromeos_browser.py index 8b4adb9..864c0c7 100755 --- a/chrome/test/functional/chromeos_browser.py +++ b/chrome/test/functional/chromeos_browser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_cellular_sanity.py b/chrome/test/functional/chromeos_cellular_sanity.py index 28e9b65..2f06d48 100644..100755 --- a/chrome/test/functional/chromeos_cellular_sanity.py +++ b/chrome/test/functional/chromeos_cellular_sanity.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_file_browser.py b/chrome/test/functional/chromeos_file_browser.py index 8e33c105..f0c211b 100644..100755 --- a/chrome/test/functional/chromeos_file_browser.py +++ b/chrome/test/functional/chromeos_file_browser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_firmware_version_checker.py b/chrome/test/functional/chromeos_firmware_version_checker.py index e95cf57..1e76179 100644..100755 --- a/chrome/test/functional/chromeos_firmware_version_checker.py +++ b/chrome/test/functional/chromeos_firmware_version_checker.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_gsm_compliance.py b/chrome/test/functional/chromeos_gsm_compliance.py index 6570031..5644356 100644..100755 --- a/chrome/test/functional/chromeos_gsm_compliance.py +++ b/chrome/test/functional/chromeos_gsm_compliance.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_login.py b/chrome/test/functional/chromeos_login.py index a9f9325..b2f42e7 100644..100755 --- a/chrome/test/functional/chromeos_login.py +++ b/chrome/test/functional/chromeos_login.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_longterm_test.py b/chrome/test/functional/chromeos_longterm_test.py index 1312b49..b25a350 100644..100755 --- a/chrome/test/functional/chromeos_longterm_test.py +++ b/chrome/test/functional/chromeos_longterm_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/chrome/test/functional/chromeos_power.py b/chrome/test/functional/chromeos_power.py index b5ab160a..b14886d 100644..100755 --- a/chrome/test/functional/chromeos_power.py +++ b/chrome/test/functional/chromeos_power.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_prefs.py b/chrome/test/functional/chromeos_prefs.py index b9eb8be..ac14414 100644..100755 --- a/chrome/test/functional/chromeos_prefs.py +++ b/chrome/test/functional/chromeos_prefs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_proxy.py b/chrome/test/functional/chromeos_proxy.py index 615ade4..4aa2949 100644..100755 --- a/chrome/test/functional/chromeos_proxy.py +++ b/chrome/test/functional/chromeos_proxy.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_security.py b/chrome/test/functional/chromeos_security.py index 40be9f6..49cea72 100644..100755 --- a/chrome/test/functional/chromeos_security.py +++ b/chrome/test/functional/chromeos_security.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_time.py b/chrome/test/functional/chromeos_time.py index c5b7d56..304a4e9 100644..100755 --- a/chrome/test/functional/chromeos_time.py +++ b/chrome/test/functional/chromeos_time.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_txt_msg_functional.py b/chrome/test/functional/chromeos_txt_msg_functional.py index e5baef7..9019e24 100644..100755 --- a/chrome/test/functional/chromeos_txt_msg_functional.py +++ b/chrome/test/functional/chromeos_txt_msg_functional.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_update.py b/chrome/test/functional/chromeos_update.py index 38557a3..9f8cb24 100644..100755 --- a/chrome/test/functional/chromeos_update.py +++ b/chrome/test/functional/chromeos_update.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_volume.py b/chrome/test/functional/chromeos_volume.py index cfea103..96b10d8 100644..100755 --- a/chrome/test/functional/chromeos_volume.py +++ b/chrome/test/functional/chromeos_volume.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_vpn.py b/chrome/test/functional/chromeos_vpn.py index 8ba6ab1..2cecf72 100644..100755 --- a/chrome/test/functional/chromeos_vpn.py +++ b/chrome/test/functional/chromeos_vpn.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_wifi_compliance.py b/chrome/test/functional/chromeos_wifi_compliance.py index edeb629..9e6d04b 100644..100755 --- a/chrome/test/functional/chromeos_wifi_compliance.py +++ b/chrome/test/functional/chromeos_wifi_compliance.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_wifi_functional.py b/chrome/test/functional/chromeos_wifi_functional.py index 3de27c3..c598575 100644..100755 --- a/chrome/test/functional/chromeos_wifi_functional.py +++ b/chrome/test/functional/chromeos_wifi_functional.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromeos_wifi_sanity.py b/chrome/test/functional/chromeos_wifi_sanity.py index e90ebf4..037397b 100644..100755 --- a/chrome/test/functional/chromeos_wifi_sanity.py +++ b/chrome/test/functional/chromeos_wifi_sanity.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/chromoting_basic.py b/chrome/test/functional/chromoting_basic.py index 4bb30f9..fb8a2fe 100644..100755 --- a/chrome/test/functional/chromoting_basic.py +++ b/chrome/test/functional/chromoting_basic.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/codesign.py b/chrome/test/functional/codesign.py index b4f553a..e942a4b 100644..100755 --- a/chrome/test/functional/codesign.py +++ b/chrome/test/functional/codesign.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/content.py b/chrome/test/functional/content.py index 0e34f24..b56038e 100644..100755 --- a/chrome/test/functional/content.py +++ b/chrome/test/functional/content.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/cookies.py b/chrome/test/functional/cookies.py index 77cede9..b936444 100644..100755 --- a/chrome/test/functional/cookies.py +++ b/chrome/test/functional/cookies.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/crash_reporter.py b/chrome/test/functional/crash_reporter.py index 2c5bb2f..85051f5 100644..100755 --- a/chrome/test/functional/crash_reporter.py +++ b/chrome/test/functional/crash_reporter.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/databases.py b/chrome/test/functional/databases.py index c4f064a..1f3e83e 100644..100755 --- a/chrome/test/functional/databases.py +++ b/chrome/test/functional/databases.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py index 97236ab..aedb74a 100644..100755 --- a/chrome/test/functional/downloads.py +++ b/chrome/test/functional/downloads.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/enterprise.py b/chrome/test/functional/enterprise.py index 5424e76..5e7978d 100644..100755 --- a/chrome/test/functional/enterprise.py +++ b/chrome/test/functional/enterprise.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/enterprise_helper_linux.py b/chrome/test/functional/enterprise_helper_linux.py index a2e5782..bdd6371 100644..100755 --- a/chrome/test/functional/enterprise_helper_linux.py +++ b/chrome/test/functional/enterprise_helper_linux.py @@ -1,9 +1,11 @@ +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Helper script to copy policy files into -# the correct managed policy location in the machine +"""Helper script to copy policy files into the correct managed policy location +in the machine. +""" import os import sys @@ -24,9 +26,11 @@ def main(): elif sys.argv[1] == 'remove_dir': os.system('rm -rf %s' % sys.argv[2]) else: - print >>sys.stderr, 'Invalid syntax. Possible values are [copy], \ - [setup_dir], [remove_dir]' + print >>sys.stderr, ( + 'Invalid syntax. Possible values are [copy], [setup_dir], [remove_dir]') + return 1 + return 0 if __name__ == '__main__': - main() + sys.exit(main()) diff --git a/chrome/test/functional/execute_javascript.py b/chrome/test/functional/execute_javascript.py index b935a51..fb81989 100644..100755 --- a/chrome/test/functional/execute_javascript.py +++ b/chrome/test/functional/execute_javascript.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/extensions.py b/chrome/test/functional/extensions.py index c949a71..4f7ed0b 100644..100755 --- a/chrome/test/functional/extensions.py +++ b/chrome/test/functional/extensions.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/find_in_page.py b/chrome/test/functional/find_in_page.py index 9a41411..db885e0 100644..100755 --- a/chrome/test/functional/find_in_page.py +++ b/chrome/test/functional/find_in_page.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/flash.py b/chrome/test/functional/flash.py index d8df26a..7923455 100644..100755 --- a/chrome/test/functional/flash.py +++ b/chrome/test/functional/flash.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/gpu.py b/chrome/test/functional/gpu.py index 172607f..3ef88e4 100644..100755 --- a/chrome/test/functional/gpu.py +++ b/chrome/test/functional/gpu.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/history.py b/chrome/test/functional/history.py index 3875dc0..7608ae4 100644..100755 --- a/chrome/test/functional/history.py +++ b/chrome/test/functional/history.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/https.py b/chrome/test/functional/https.py index af6c910..ee48c09 100644..100755 --- a/chrome/test/functional/https.py +++ b/chrome/test/functional/https.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/imports.py b/chrome/test/functional/imports.py index 197a5ba..6baed36 100644..100755 --- a/chrome/test/functional/imports.py +++ b/chrome/test/functional/imports.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/indexeddb.py b/chrome/test/functional/indexeddb.py index 94ae9d8..cb8d371 100644..100755 --- a/chrome/test/functional/indexeddb.py +++ b/chrome/test/functional/indexeddb.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/infobars.py b/chrome/test/functional/infobars.py index e6f5c4e..6ba437c 100644..100755 --- a/chrome/test/functional/infobars.py +++ b/chrome/test/functional/infobars.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/instant.py b/chrome/test/functional/instant.py index f05f4a0..31836337 100644..100755 --- a/chrome/test/functional/instant.py +++ b/chrome/test/functional/instant.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_event_simple_action.py b/chrome/test/functional/media/media_event_simple_action.py index f92a826..69db145 100644..100755 --- a/chrome/test/functional/media/media_event_simple_action.py +++ b/chrome/test/functional/media/media_event_simple_action.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_event_simple_test.py b/chrome/test/functional/media/media_event_simple_test.py index 4047bfe..9c6ee24 100755 --- a/chrome/test/functional/media/media_event_simple_test.py +++ b/chrome/test/functional/media/media_event_simple_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_event_test_base.py b/chrome/test/functional/media/media_event_test_base.py index d380d1c..39b40860 100755..100644 --- a/chrome/test/functional/media/media_event_test_base.py +++ b/chrome/test/functional/media/media_event_test_base.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_event_track.py b/chrome/test/functional/media/media_event_track.py index b355efe..513325c 100644..100755 --- a/chrome/test/functional/media/media_event_track.py +++ b/chrome/test/functional/media/media_event_track.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_fps.py b/chrome/test/functional/media/media_fps.py index bfb09f7..fcf1936 100755 --- a/chrome/test/functional/media/media_fps.py +++ b/chrome/test/functional/media/media_fps.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_jerky.py b/chrome/test/functional/media/media_jerky.py index 146051c..0bcc21f 100755 --- a/chrome/test/functional/media/media_jerky.py +++ b/chrome/test/functional/media/media_jerky.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_perf.py b/chrome/test/functional/media/media_perf.py index ebe3e1e..16ab637 100755 --- a/chrome/test/functional/media/media_perf.py +++ b/chrome/test/functional/media/media_perf.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_playbacktime.py b/chrome/test/functional/media/media_playbacktime.py index e30b41a..e7c478c 100755 --- a/chrome/test/functional/media/media_playbacktime.py +++ b/chrome/test/functional/media/media_playbacktime.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_test_base.py b/chrome/test/functional/media/media_test_base.py index 9d21565..3272fd9 100755 --- a/chrome/test/functional/media/media_test_base.py +++ b/chrome/test/functional/media/media_test_base.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_test_env_names.py b/chrome/test/functional/media/media_test_env_names.py index e26a8fa..ee70df8 100644 --- a/chrome/test/functional/media/media_test_env_names.py +++ b/chrome/test/functional/media/media_test_env_names.py @@ -1,10 +1,9 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -class MediaTestEnvNames: +class MediaTestEnvNames(object): """Class that contains all environment names used in media tests. Since PyAuto does not support commandline arguments, we have to rely on diff --git a/chrome/test/functional/media/media_test_matrix.py b/chrome/test/functional/media/media_test_matrix.py index b04a22d..2d6b110 100644 --- a/chrome/test/functional/media/media_test_matrix.py +++ b/chrome/test/functional/media/media_test_matrix.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_test_matrix_unittest.py b/chrome/test/functional/media/media_test_matrix_unittest.py index 429ceb5..9f1164a 100644..100755 --- a/chrome/test/functional/media/media_test_matrix_unittest.py +++ b/chrome/test/functional/media/media_test_matrix_unittest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_test_runner.py b/chrome/test/functional/media/media_test_runner.py index cab6783..c6d43e4 100755 --- a/chrome/test/functional/media/media_test_runner.py +++ b/chrome/test/functional/media/media_test_runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/media_track.py b/chrome/test/functional/media/media_track.py index bb90db9..59ec3f8 100755 --- a/chrome/test/functional/media/media_track.py +++ b/chrome/test/functional/media/media_track.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/pyauto_media.py b/chrome/test/functional/media/pyauto_media.py index f9e2646..88b062a 100644..100755 --- a/chrome/test/functional/media/pyauto_media.py +++ b/chrome/test/functional/media/pyauto_media.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/ui_perf_test_measure_thread.py b/chrome/test/functional/media/ui_perf_test_measure_thread.py index bc5d79c..1523289 100644..100755 --- a/chrome/test/functional/media/ui_perf_test_measure_thread.py +++ b/chrome/test/functional/media/ui_perf_test_measure_thread.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/ui_perf_test_utils.py b/chrome/test/functional/media/ui_perf_test_utils.py index cb7e28d..c09c6bb 100644 --- a/chrome/test/functional/media/ui_perf_test_utils.py +++ b/chrome/test/functional/media/ui_perf_test_utils.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/media/ui_perf_test_utils_unittest.py b/chrome/test/functional/media/ui_perf_test_utils_unittest.py index db64166..6efc2c9 100644 --- a/chrome/test/functional/media/ui_perf_test_utils_unittest.py +++ b/chrome/test/functional/media/ui_perf_test_utils_unittest.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/memory.py b/chrome/test/functional/memory.py index bf7e044..11029fb 100644..100755 --- a/chrome/test/functional/memory.py +++ b/chrome/test/functional/memory.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/multiprofile.py b/chrome/test/functional/multiprofile.py index 607dc26..9ae50bc 100644..100755 --- a/chrome/test/functional/multiprofile.py +++ b/chrome/test/functional/multiprofile.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/nacl_sdk.py b/chrome/test/functional/nacl_sdk.py index 6978c91..f3c9ed2 100644..100755 --- a/chrome/test/functional/nacl_sdk.py +++ b/chrome/test/functional/nacl_sdk.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -1083,4 +1083,4 @@ class NaClSDKTest(pyauto.PyUITest): if __name__ == '__main__': - pyauto_functional.Main()
\ No newline at end of file + pyauto_functional.Main() diff --git a/chrome/test/functional/navigation.py b/chrome/test/functional/navigation.py index 943f289..5bf4885 100644..100755 --- a/chrome/test/functional/navigation.py +++ b/chrome/test/functional/navigation.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/netflix.py b/chrome/test/functional/netflix.py index 0299884..a20d91a 100644..100755 --- a/chrome/test/functional/netflix.py +++ b/chrome/test/functional/netflix.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/notifications.py b/chrome/test/functional/notifications.py index 8197834..762deb4 100644..100755 --- a/chrome/test/functional/notifications.py +++ b/chrome/test/functional/notifications.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/ntp.py b/chrome/test/functional/ntp.py index 3086ee6..b49739a 100644..100755 --- a/chrome/test/functional/ntp.py +++ b/chrome/test/functional/ntp.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/omnibox.py b/chrome/test/functional/omnibox.py index eee5af6..b9039c9 100644..100755 --- a/chrome/test/functional/omnibox.py +++ b/chrome/test/functional/omnibox.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/omniboxmodel.py b/chrome/test/functional/omniboxmodel.py index 91326b0..3c4a741 100644..100755 --- a/chrome/test/functional/omniboxmodel.py +++ b/chrome/test/functional/omniboxmodel.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -132,4 +132,3 @@ class OmniboxModelTest(autotour.Godel, PyUITest): if __name__ == '__main__': pyauto_functional.Main() - diff --git a/chrome/test/functional/passwords.py b/chrome/test/functional/passwords.py index 2f9645b..1d601e3 100644..100755 --- a/chrome/test/functional/passwords.py +++ b/chrome/test/functional/passwords.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/pdf.py b/chrome/test/functional/pdf.py index f65af12..04435ed 100644..100755 --- a/chrome/test/functional/pdf.py +++ b/chrome/test/functional/pdf.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/perf.py b/chrome/test/functional/perf.py index dd0d778..6cb7692 100644..100755 --- a/chrome/test/functional/perf.py +++ b/chrome/test/functional/perf.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/plugins.py b/chrome/test/functional/plugins.py index 725d577..5ee98d2 100644..100755 --- a/chrome/test/functional/plugins.py +++ b/chrome/test/functional/plugins.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/plugins_check.py b/chrome/test/functional/plugins_check.py index 0da3c1b..bfba17f 100644..100755 --- a/chrome/test/functional/plugins_check.py +++ b/chrome/test/functional/plugins_check.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/policy.py b/chrome/test/functional/policy.py index d2bd62a..0d1b837 100644..100755 --- a/chrome/test/functional/policy.py +++ b/chrome/test/functional/policy.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/policy_prefs_ui.py b/chrome/test/functional/policy_prefs_ui.py index d0d641b..4a76b09 100644..100755 --- a/chrome/test/functional/policy_prefs_ui.py +++ b/chrome/test/functional/policy_prefs_ui.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/popups.py b/chrome/test/functional/popups.py index ebf4e1f..f2b3c58 100644..100755 --- a/chrome/test/functional/popups.py +++ b/chrome/test/functional/popups.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/prefetch.py b/chrome/test/functional/prefetch.py index 30c0912..f53751d 100644..100755 --- a/chrome/test/functional/prefetch.py +++ b/chrome/test/functional/prefetch.py @@ -1,17 +1,20 @@ -#!/usr/bin/python -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +#!/usr/bin/env python +# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# this functional test spawns a web server, and runs chrome to point -# at that web server. The content served contains prefetch requests, -# and the tests assert that the webserver logs reflect that. +"""This functional test spawns a web server, and runs chrome to point +at that web server. -# run like any functional test: -# $ python chrome/test/functional/prefetch.py -# in a repo with a built pyautolib +The content served contains prefetch requests, and the tests assert that the +webserver logs reflect that. -# the import of multiprocessing implies python 2.6 is required +Run like any functional test: +$ python chrome/test/functional/prefetch.py +in a repo with a built pyautolib + +The import of multiprocessing implies python 2.6 is required +""" import os import time diff --git a/chrome/test/functional/prefs.py b/chrome/test/functional/prefs.py index ca74bd2..ee85315 100644..100755 --- a/chrome/test/functional/prefs.py +++ b/chrome/test/functional/prefs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -209,4 +209,3 @@ class PrefsTest(pyauto.PyUITest): if __name__ == '__main__': pyauto_functional.Main() - diff --git a/chrome/test/functional/process_count.py b/chrome/test/functional/process_count.py index d082d71..7f4d902 100644..100755 --- a/chrome/test/functional/process_count.py +++ b/chrome/test/functional/process_count.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/pyauto_functional.py b/chrome/test/functional/pyauto_functional.py index ec2ed00..1937a08 100644..100755 --- a/chrome/test/functional/pyauto_functional.py +++ b/chrome/test/functional/pyauto_functional.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/pyauto_webdriver.py b/chrome/test/functional/pyauto_webdriver.py index b72570c..deb39c0 100644..100755 --- a/chrome/test/functional/pyauto_webdriver.py +++ b/chrome/test/functional/pyauto_webdriver.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/remote_host_functional.py b/chrome/test/functional/remote_host_functional.py index 010fcff..4d9209d 100644..100755 --- a/chrome/test/functional/remote_host_functional.py +++ b/chrome/test/functional/remote_host_functional.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/search_engines.py b/chrome/test/functional/search_engines.py index 2115262..2fcf9e8 100644..100755 --- a/chrome/test/functional/search_engines.py +++ b/chrome/test/functional/search_engines.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/shortcuts.py b/chrome/test/functional/shortcuts.py index cf420eb..60167f1 100644..100755 --- a/chrome/test/functional/shortcuts.py +++ b/chrome/test/functional/shortcuts.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/special_tabs.py b/chrome/test/functional/special_tabs.py index 6e2ec9d..d6e38a9 100644..100755 --- a/chrome/test/functional/special_tabs.py +++ b/chrome/test/functional/special_tabs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/stress.py b/chrome/test/functional/stress.py index 53ee9bd..5916b05 100644..100755 --- a/chrome/test/functional/stress.py +++ b/chrome/test/functional/stress.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/sync.py b/chrome/test/functional/sync.py index 33c9b55..94a78d2 100644..100755 --- a/chrome/test/functional/sync.py +++ b/chrome/test/functional/sync.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/test_basic.py b/chrome/test/functional/test_basic.py index 789001d..769cfda 100644..100755 --- a/chrome/test/functional/test_basic.py +++ b/chrome/test/functional/test_basic.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/test_pyauto.py b/chrome/test/functional/test_pyauto.py index 93f06cc..80fdaf4 100644..100755 --- a/chrome/test/functional/test_pyauto.py +++ b/chrome/test/functional/test_pyauto.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/test_utils.py b/chrome/test/functional/test_utils.py index 260dcb8..5e3a291 100644 --- a/chrome/test/functional/test_utils.py +++ b/chrome/test/functional/test_utils.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/themes.py b/chrome/test/functional/themes.py index b718949..bd94874 100644..100755 --- a/chrome/test/functional/themes.py +++ b/chrome/test/functional/themes.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/translate.py b/chrome/test/functional/translate.py index d4a73a4..986f0a1 100644..100755 --- a/chrome/test/functional/translate.py +++ b/chrome/test/functional/translate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/ui_model.py b/chrome/test/functional/ui_model.py index 3eeabfc..aac3587 100644 --- a/chrome/test/functional/ui_model.py +++ b/chrome/test/functional/ui_model.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/ui_runner.py b/chrome/test/functional/ui_runner.py index 708e76b..fb8bad1 100644..100755 --- a/chrome/test/functional/ui_runner.py +++ b/chrome/test/functional/ui_runner.py @@ -1,5 +1,4 @@ -#!/usr/bin/python - +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -245,4 +244,4 @@ class Runner(pyauto.PyUITest): if __name__ == '__main__': - pyauto_functional.Main()
\ No newline at end of file + pyauto_functional.Main() diff --git a/chrome/test/functional/webdriver_pages/__init__.py b/chrome/test/functional/webdriver_pages/__init__.py index 0427d00..e69de29 100644..100755 --- a/chrome/test/functional/webdriver_pages/__init__.py +++ b/chrome/test/functional/webdriver_pages/__init__.py @@ -1,4 +0,0 @@ -#!/usr/bin/python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. diff --git a/chrome/test/functional/webdriver_pages/settings.py b/chrome/test/functional/webdriver_pages/settings.py index 3b8433b..e733bf6 100644 --- a/chrome/test/functional/webdriver_pages/settings.py +++ b/chrome/test/functional/webdriver_pages/settings.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/wifi_downloads.py b/chrome/test/functional/wifi_downloads.py index b6024fe..2bd54e1 100644..100755 --- a/chrome/test/functional/wifi_downloads.py +++ b/chrome/test/functional/wifi_downloads.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/wifi_notification.py b/chrome/test/functional/wifi_notification.py index f5819d3..316d4a6 100644..100755 --- a/chrome/test/functional/wifi_notification.py +++ b/chrome/test/functional/wifi_notification.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/chrome/test/functional/youtube.py b/chrome/test/functional/youtube.py index ae47ff7..895e93f 100644..100755 --- a/chrome/test/functional/youtube.py +++ b/chrome/test/functional/youtube.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. |