Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from chrome_remote_control import multi_page_benchmark | |
| 6 from chrome_remote_control import util | |
| 7 | |
| 8 class Spaceport(multi_page_benchmark.MultiPageBenchmark): | |
|
nduca
2012/11/04 19:53:30
SpaceportBenchmark
tonyg
2012/11/05 23:02:01
Done.
| |
| 9 def CustomizeBrowserOptions(self, options): | |
| 10 options.extra_browser_args.extend(['--disable-gpu-vsync']) | |
| 11 | |
| 12 def MeasurePage(self, _, tab, results): | |
| 13 tab.runtime.Execute(""" | |
| 14 window.__results = {}; | |
| 15 window.console.log = function(str) { | |
| 16 if (!str) return; | |
| 17 var key_val = str.split(': '); | |
| 18 if (!key_val.length == 2) return; | |
| 19 __results[key_val[0]] = key_val[1]; | |
| 20 }; | |
| 21 """) | |
| 22 | |
|
nduca
2012/11/04 19:53:30
how are we protecting ourselves from running this
tonyg
2012/11/05 23:02:01
Rather than start the test with ?auto, I added a b
| |
| 23 js_get_results = 'JSON.stringify(window.__results)' | |
|
nduca
2012/11/04 19:53:30
why put the js here rather than just inside the ev
tonyg
2012/11/05 23:02:01
Because it is used twice.
| |
| 24 def _IsDone(): | |
| 25 num_tests_in_benchmark = 30 | |
| 26 result_dict = eval(tab.runtime.Evaluate(js_get_results)) | |
| 27 return num_tests_in_benchmark == len(result_dict) | |
| 28 util.WaitFor(_IsDone, 1200) | |
| 29 | |
| 30 result_dict = eval(tab.runtime.Evaluate(js_get_results)) | |
| 31 for key in result_dict: | |
| 32 results.Add(key, 'ObjectsAt30FPS', float(result_dict[key])) | |
| 33 results.Add('Overall', 'ObjectsAt30FPS', | |
| 34 [float(x) for x in result_dict.values()]) | |
| OLD | NEW |