Chromium Code Reviews| Index: tools/perf/perf_tools/spaceport.py | 
| diff --git a/tools/perf/perf_tools/spaceport.py b/tools/perf/perf_tools/spaceport.py | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..6a184908c0f6d53d9604907377b18e6ed398dd65 | 
| --- /dev/null | 
| +++ b/tools/perf/perf_tools/spaceport.py | 
| @@ -0,0 +1,34 @@ | 
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| +# Use of this source code is governed by a BSD-style license that can be | 
| +# found in the LICENSE file. | 
| + | 
| +from chrome_remote_control import multi_page_benchmark | 
| +from chrome_remote_control import util | 
| + | 
| +class Spaceport(multi_page_benchmark.MultiPageBenchmark): | 
| 
 
nduca
2012/11/04 19:53:30
SpaceportBenchmark
 
tonyg
2012/11/05 23:02:01
Done.
 
 | 
| + def CustomizeBrowserOptions(self, options): | 
| + options.extra_browser_args.extend(['--disable-gpu-vsync']) | 
| + | 
| + def MeasurePage(self, _, tab, results): | 
| + tab.runtime.Execute(""" | 
| + window.__results = {}; | 
| + window.console.log = function(str) { | 
| + if (!str) return; | 
| + var key_val = str.split(': '); | 
| + if (!key_val.length == 2) return; | 
| + __results[key_val[0]] = key_val[1]; | 
| + }; | 
| + """) | 
| + | 
| 
 
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
 
 | 
| + 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.
 
 | 
| + def _IsDone(): | 
| + num_tests_in_benchmark = 30 | 
| + result_dict = eval(tab.runtime.Evaluate(js_get_results)) | 
| + return num_tests_in_benchmark == len(result_dict) | 
| + util.WaitFor(_IsDone, 1200) | 
| + | 
| + result_dict = eval(tab.runtime.Evaluate(js_get_results)) | 
| + for key in result_dict: | 
| + results.Add(key, 'ObjectsAt30FPS', float(result_dict[key])) | 
| + results.Add('Overall', 'ObjectsAt30FPS', | 
| + [float(x) for x in result_dict.values()]) |