Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 | |
| 7 from telemetry import test | |
| 8 from telemetry.core import util | |
| 9 from telemetry.page import page_set | |
| 10 | |
| 11 from measurements import blink_perf | |
| 12 | |
| 13 | |
| 14 def _CreatePageSetFromPath(path): | |
| 15 assert os.path.exists(path) | |
| 16 | |
| 17 page_set_dict = {'pages': []} | |
| 18 | |
| 19 def _AddPage(path): | |
|
tonyg
2013/07/18 01:39:00
I assume all this is duplicated with blink_perf.py
dtu
2013/07/18 02:17:05
Done.
| |
| 20 if not path.endswith('.html'): | |
| 21 return | |
| 22 if '../' in open(path, 'r').read(): | |
| 23 # If the page looks like it references its parent dir, include it. | |
| 24 page_set_dict['serving_dirs'] = [os.path.dirname(os.path.dirname(path))] | |
| 25 page_set_dict['pages'].append({'url': | |
| 26 'file://' + path.replace('\\', '/')}) | |
| 27 | |
| 28 def _AddDir(dir_path, skipped): | |
| 29 for path in os.listdir(dir_path): | |
| 30 if path == 'resources': | |
| 31 continue | |
| 32 path = os.path.join(dir_path, path) | |
| 33 if path.startswith(tuple([os.path.join(path, s) | |
| 34 for s in skipped])): | |
| 35 continue | |
| 36 if os.path.isdir(path): | |
| 37 _AddDir(path, skipped) | |
| 38 else: | |
| 39 _AddPage(path) | |
| 40 | |
| 41 if os.path.isdir(path): | |
| 42 skipped = [] | |
| 43 skipped_file = os.path.join(path, 'Skipped') | |
| 44 if os.path.exists(skipped_file): | |
| 45 for line in open(skipped_file, 'r').readlines(): | |
| 46 line = line.strip() | |
| 47 if line and not line.startswith('#'): | |
| 48 skipped.append(line.replace('/', os.sep)) | |
| 49 _AddDir(path, skipped) | |
| 50 else: | |
| 51 _AddPage(path) | |
| 52 return page_set.PageSet.FromDict(page_set_dict, os.getcwd() + os.sep) | |
| 53 | |
| 54 | |
| 55 class BlinkPerfAll(test.Test): | |
| 56 test = blink_perf.BlinkPerf | |
| 57 | |
| 58 def CreatePageSet(self, options): | |
| 59 path = os.path.join( | |
| 60 util.GetChromiumSrcDir(), 'third_party', 'WebKit', 'PerformanceTests') | |
| 61 return _CreatePageSetFromPath(path) | |
| OLD | NEW |