| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 | 6 |
| 7 from telemetry import benchmark | 7 from telemetry import benchmark |
| 8 from telemetry.core import util | 8 from telemetry.core import util |
| 9 from telemetry.page import page_set | 9 from telemetry.page import page_set |
| 10 from telemetry.page import page_test | 10 from telemetry.page import page_test |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 if '../' in open(path, 'r').read(): | 28 if '../' in open(path, 'r').read(): |
| 29 # If the page looks like it references its parent dir, include it. | 29 # If the page looks like it references its parent dir, include it. |
| 30 serving_dirs.add(os.path.dirname(os.path.dirname(path))) | 30 serving_dirs.add(os.path.dirname(os.path.dirname(path))) |
| 31 page_urls.append('file://' + path.replace('\\', '/')) | 31 page_urls.append('file://' + path.replace('\\', '/')) |
| 32 | 32 |
| 33 def _AddDir(dir_path, skipped): | 33 def _AddDir(dir_path, skipped): |
| 34 for candidate_path in os.listdir(dir_path): | 34 for candidate_path in os.listdir(dir_path): |
| 35 if candidate_path == 'resources': | 35 if candidate_path == 'resources': |
| 36 continue | 36 continue |
| 37 candidate_path = os.path.join(dir_path, candidate_path) | 37 candidate_path = os.path.join(dir_path, candidate_path) |
| 38 if candidate_path.startswith(tuple([os.path.join(path, s) | 38 if candidate_path.startswith(skipped): |
| 39 for s in skipped])): | |
| 40 continue | 39 continue |
| 41 if os.path.isdir(candidate_path): | 40 if os.path.isdir(candidate_path): |
| 42 _AddDir(candidate_path, skipped) | 41 _AddDir(candidate_path, skipped) |
| 43 else: | 42 else: |
| 44 _AddPage(candidate_path) | 43 _AddPage(candidate_path) |
| 45 | 44 |
| 46 if os.path.isdir(path): | 45 if os.path.isdir(path): |
| 47 skipped = [] | 46 skipped = [] |
| 48 if os.path.exists(skipped_file): | 47 if os.path.exists(skipped_file): |
| 49 for line in open(skipped_file, 'r').readlines(): | 48 for line in open(skipped_file, 'r').readlines(): |
| 50 line = line.strip() | 49 line = line.strip() |
| 51 if line and not line.startswith('#'): | 50 if line and not line.startswith('#'): |
| 52 skipped.append(line.replace('/', os.sep)) | 51 skipped_path = os.path.join(os.path.dirname(skipped_file), line) |
| 53 _AddDir(path, skipped) | 52 skipped.append(skipped_path.replace('/', os.sep)) |
| 53 _AddDir(path, tuple(skipped)) |
| 54 else: | 54 else: |
| 55 _AddPage(path) | 55 _AddPage(path) |
| 56 ps = page_set.PageSet(file_path=os.getcwd()+os.sep, serving_dirs=serving_dirs) | 56 ps = page_set.PageSet(file_path=os.getcwd()+os.sep, serving_dirs=serving_dirs) |
| 57 for url in page_urls: | 57 for url in page_urls: |
| 58 ps.AddPageWithDefaultRunNavigate(url) | 58 ps.AddPageWithDefaultRunNavigate(url) |
| 59 return ps | 59 return ps |
| 60 | 60 |
| 61 | 61 |
| 62 class _BlinkPerfMeasurement(page_test.PageTest): | 62 class _BlinkPerfMeasurement(page_test.PageTest): |
| 63 """Tuns a blink performance test and reports the results.""" | 63 """Tuns a blink performance test and reports the results.""" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 | 230 |
| 231 @benchmark.Enabled('android') | 231 @benchmark.Enabled('android') |
| 232 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): | 232 class BlinkPerfXMLHttpRequest(benchmark.Benchmark): |
| 233 tag = 'xml_http_request' | 233 tag = 'xml_http_request' |
| 234 test = _BlinkPerfMeasurement | 234 test = _BlinkPerfMeasurement |
| 235 | 235 |
| 236 def CreatePageSet(self, options): | 236 def CreatePageSet(self, options): |
| 237 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') | 237 path = os.path.join(BLINK_PERF_BASE_DIR, 'XMLHttpRequest') |
| 238 return _CreatePageSetFromPath(path, SKIPPED_FILE) | 238 return _CreatePageSetFromPath(path, SKIPPED_FILE) |
| OLD | NEW |