OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from telemetry.core import util | 4 |
5 from telemetry.page import multi_page_benchmark | 5 from telemetry import multi_page_benchmark |
| 6 from telemetry import util |
6 | 7 |
7 class Octane(multi_page_benchmark.MultiPageBenchmark): | 8 class Octane(multi_page_benchmark.MultiPageBenchmark): |
8 def MeasurePage(self, _, tab, results): | 9 def MeasurePage(self, _, tab, results): |
9 js_is_done = """ | 10 js_is_done = """ |
10 completed && !document.getElementById("progress-bar-container")""" | 11 completed && !document.getElementById("progress-bar-container")""" |
11 def _IsDone(): | 12 def _IsDone(): |
12 return bool(tab.EvaluateJavaScript(js_is_done)) | 13 return bool(tab.EvaluateJavaScript(js_is_done)) |
13 util.WaitFor(_IsDone, 300, poll_interval=5) | 14 util.WaitFor(_IsDone, 300, poll_interval=5) |
14 | 15 |
15 js_get_results = """ | 16 js_get_results = """ |
(...skipping 10 matching lines...) Expand all Loading... |
26 JSON.stringify(results); | 27 JSON.stringify(results); |
27 """ | 28 """ |
28 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) | 29 result_dict = eval(tab.EvaluateJavaScript(js_get_results)) |
29 for key, value in result_dict.iteritems(): | 30 for key, value in result_dict.iteritems(): |
30 if value == '...': | 31 if value == '...': |
31 continue | 32 continue |
32 data_type = 'unimportant' | 33 data_type = 'unimportant' |
33 if key == 'score': | 34 if key == 'score': |
34 data_type = 'default' | 35 data_type = 'default' |
35 results.Add(key, 'score (bigger is better)', value, data_type=data_type) | 36 results.Add(key, 'score (bigger is better)', value, data_type=data_type) |
OLD | NEW |