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 import collections | 4 import collections |
5 import json | 5 import json |
6 import os | 6 import os |
7 | 7 |
8 from metrics import power | 8 from metrics import power |
9 from telemetry import benchmark | 9 from telemetry import benchmark |
10 from telemetry.page import page_set | 10 from telemetry.page import page_set |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 | 74 |
75 class _SunspiderMeasurement(page_test.PageTest): | 75 class _SunspiderMeasurement(page_test.PageTest): |
76 def __init__(self): | 76 def __init__(self): |
77 super(_SunspiderMeasurement, self).__init__() | 77 super(_SunspiderMeasurement, self).__init__() |
78 self._power_metric = None | 78 self._power_metric = None |
79 | 79 |
80 def CustomizeBrowserOptions(self, options): | 80 def CustomizeBrowserOptions(self, options): |
81 power.PowerMetric.CustomizeBrowserOptions(options) | 81 power.PowerMetric.CustomizeBrowserOptions(options) |
82 | 82 |
83 def WillStartBrowser(self, platform): | 83 def WillStartBrowser(self, browser): |
84 self._power_metric = power.PowerMetric(platform) | 84 self._power_metric = power.PowerMetric(browser) |
85 | 85 |
86 def DidNavigateToPage(self, page, tab): | 86 def DidNavigateToPage(self, page, tab): |
87 self._power_metric.Start(page, tab) | 87 self._power_metric.Start(page, tab) |
88 | 88 |
89 def ValidateAndMeasurePage(self, page, tab, results): | 89 def ValidateAndMeasurePage(self, page, tab, results): |
90 tab.WaitForJavaScriptExpression( | 90 tab.WaitForJavaScriptExpression( |
91 'window.location.pathname.indexOf("results.html") >= 0' | 91 'window.location.pathname.indexOf("results.html") >= 0' |
92 '&& typeof(output) != "undefined"', 300) | 92 '&& typeof(output) != "undefined"', 300) |
93 | 93 |
94 self._power_metric.Stop(page, tab) | 94 self._power_metric.Stop(page, tab) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 """Apple's SunSpider JavaScript benchmark.""" | 127 """Apple's SunSpider JavaScript benchmark.""" |
128 test = _SunspiderMeasurement | 128 test = _SunspiderMeasurement |
129 | 129 |
130 def CreatePageSet(self, options): | 130 def CreatePageSet(self, options): |
131 ps = page_set.PageSet( | 131 ps = page_set.PageSet( |
132 archive_data_file='../page_sets/data/sunspider.json', | 132 archive_data_file='../page_sets/data/sunspider.json', |
133 make_javascript_deterministic=False, | 133 make_javascript_deterministic=False, |
134 file_path=os.path.abspath(__file__)) | 134 file_path=os.path.abspath(__file__)) |
135 ps.AddPageWithDefaultRunNavigate(_URL) | 135 ps.AddPageWithDefaultRunNavigate(_URL) |
136 return ps | 136 return ps |
OLD | NEW |