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