| 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 metrics import power | 7 from metrics import power |
| 8 from telemetry import test | 8 from telemetry import test |
| 9 from telemetry.core import util | 9 from telemetry.core import util |
| 10 from telemetry.page import page_measurement | 10 from telemetry.page import page_measurement |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 class _DromaeoBenchmark(test.Test): | 50 class _DromaeoBenchmark(test.Test): |
| 51 """A base class for Dromaeo benchmarks.""" | 51 """A base class for Dromaeo benchmarks.""" |
| 52 test = _DromaeoMeasurement | 52 test = _DromaeoMeasurement |
| 53 | 53 |
| 54 def CreatePageSet(self, options): | 54 def CreatePageSet(self, options): |
| 55 """Makes a PageSet for Dromaeo benchmarks.""" | 55 """Makes a PageSet for Dromaeo benchmarks.""" |
| 56 # Subclasses are expected to define a class member called query_param. | 56 # Subclasses are expected to define a class member called query_param. |
| 57 if not hasattr(self, 'query_param'): | 57 if not hasattr(self, 'query_param'): |
| 58 raise NotImplementedError('query_param not in Dromaeo benchmark.') | 58 raise NotImplementedError('query_param not in Dromaeo benchmark.') |
| 59 url = 'file://index.html?%s&automated' % self.query_param | 59 url = 'file://index.html?%s&automated' % self.query_param |
| 60 # The docstring of benchmark classes may also be used as a description | |
| 61 # when 'run_benchmarks list' is run. | |
| 62 description = self.__doc__ or 'Dromaeo JavaScript Benchmark' | |
| 63 dromaeo_dir = os.path.join(util.GetChromiumSrcDir(), | 60 dromaeo_dir = os.path.join(util.GetChromiumSrcDir(), |
| 64 'chrome', 'test', 'data', 'dromaeo') | 61 'chrome', 'test', 'data', 'dromaeo') |
| 65 ps = page_set.PageSet(description=description, | 62 ps = page_set.PageSet(file_path=dromaeo_dir) |
| 66 file_path=dromaeo_dir) | |
| 67 ps.AddPageWithDefaultRunNavigate(url) | 63 ps.AddPageWithDefaultRunNavigate(url) |
| 68 return ps | 64 return ps |
| 69 | 65 |
| 70 | 66 |
| 71 class DromaeoDomCoreAttr(_DromaeoBenchmark): | 67 class DromaeoDomCoreAttr(_DromaeoBenchmark): |
| 72 """Dromaeo DOMCore attr JavaScript benchmark.""" | 68 """Dromaeo DOMCore attr JavaScript benchmark.""" |
| 73 tag = 'domcoreattr' | 69 tag = 'domcoreattr' |
| 74 query_param = 'dom-attr' | 70 query_param = 'dom-attr' |
| 75 | 71 |
| 76 | 72 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 """Dromaeo JSLib traverse jquery JavaScript benchmark""" | 141 """Dromaeo JSLib traverse jquery JavaScript benchmark""" |
| 146 tag = 'jslibtraversejquery' | 142 tag = 'jslibtraversejquery' |
| 147 query_param = 'jslib-traverse-jquery' | 143 query_param = 'jslib-traverse-jquery' |
| 148 | 144 |
| 149 | 145 |
| 150 class DromaeoJslibTraversePrototype(_DromaeoBenchmark): | 146 class DromaeoJslibTraversePrototype(_DromaeoBenchmark): |
| 151 """Dromaeo JSLib traverse prototype JavaScript benchmark""" | 147 """Dromaeo JSLib traverse prototype JavaScript benchmark""" |
| 152 tag = 'jslibtraverseprototype' | 148 tag = 'jslibtraverseprototype' |
| 153 query_param = 'jslib-traverse-prototype' | 149 query_param = 'jslib-traverse-prototype' |
| 154 | 150 |
| OLD | NEW |