| Index: tools/perf/measurements/blink_perf.py
|
| diff --git a/tools/perf/measurements/blink_perf.py b/tools/perf/measurements/blink_perf.py
|
| index 6ad4c1dd3896ca05145b587de4f2b2f18d996a69..c9c5af9ab91896ff8dd8056fd21ac78afdadcac8 100644
|
| --- a/tools/perf/measurements/blink_perf.py
|
| +++ b/tools/perf/measurements/blink_perf.py
|
| @@ -12,6 +12,47 @@ from telemetry.page import page_measurement
|
| from telemetry.page import page_set
|
|
|
|
|
| +def CreatePageSetFromPath(path):
|
| + assert os.path.exists(path)
|
| +
|
| + page_set_dict = {'pages': []}
|
| +
|
| + def _AddPage(path):
|
| + if not path.endswith('.html'):
|
| + return
|
| + if '../' in open(path, 'r').read():
|
| + # If the page looks like it references its parent dir, include it.
|
| + page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))]
|
| + page_set_dict['pages'].append({'url':
|
| + 'file://' + path.replace('\\', '/')})
|
| +
|
| + def _AddDir(dir_path, skipped):
|
| + for path in os.listdir(dir_path):
|
| + if path == 'resources':
|
| + continue
|
| + path = os.path.join(dir_path, path)
|
| + if path.startswith(tuple([os.path.join(path, s)
|
| + for s in skipped])):
|
| + continue
|
| + if os.path.isdir(path):
|
| + _AddDir(path, skipped)
|
| + else:
|
| + _AddPage(path)
|
| +
|
| + if os.path.isdir(path):
|
| + skipped = []
|
| + skipped_file = os.path.join(path, 'Skipped')
|
| + if os.path.exists(skipped_file):
|
| + for line in open(skipped_file, 'r').readlines():
|
| + line = line.strip()
|
| + if line and not line.startswith('#'):
|
| + skipped.append(line.replace('/', os.sep))
|
| + _AddDir(path, skipped)
|
| + else:
|
| + _AddPage(path)
|
| + return page_set.PageSet.FromDict(page_set_dict, os.getcwd() + os.sep)
|
| +
|
| +
|
| class BlinkPerf(page_measurement.PageMeasurement):
|
| def __init__(self):
|
| super(BlinkPerf, self).__init__('')
|
| @@ -30,42 +71,7 @@ class BlinkPerf(page_measurement.PageMeasurement):
|
| print '%s does not exist.' % page_set_arg
|
| sys.exit(1)
|
|
|
| - page_set_dict = {'pages': []}
|
| -
|
| - def _AddPage(path):
|
| - if not path.endswith('.html'):
|
| - return
|
| - if '../' in open(path, 'r').read():
|
| - # If the page looks like it references its parent dir, include it.
|
| - page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))]
|
| - page_set_dict['pages'].append({'url':
|
| - 'file://' + path.replace('\\', '/')})
|
| -
|
| - def _AddDir(dir_path, skipped):
|
| - for path in os.listdir(dir_path):
|
| - if path == 'resources':
|
| - continue
|
| - path = os.path.join(dir_path, path)
|
| - if path.startswith(tuple([os.path.join(page_set_arg, s)
|
| - for s in skipped])):
|
| - continue
|
| - if os.path.isdir(path):
|
| - _AddDir(path, skipped)
|
| - else:
|
| - _AddPage(path)
|
| -
|
| - if os.path.isdir(page_set_arg):
|
| - skipped = []
|
| - skipped_file = os.path.join(page_set_arg, 'Skipped')
|
| - if os.path.exists(skipped_file):
|
| - for line in open(skipped_file, 'r').readlines():
|
| - line = line.strip()
|
| - if line and not line.startswith('#'):
|
| - skipped.append(line.replace('/', os.sep))
|
| - _AddDir(page_set_arg, skipped)
|
| - else:
|
| - _AddPage(page_set_arg)
|
| - return page_set.PageSet.FromDict(page_set_dict, os.getcwd() + os.sep)
|
| + return CreatePageSetFromPath(page_set_arg)
|
|
|
| @property
|
| def results_are_the_same_on_every_page(self):
|
|
|