OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import re | 7 import re |
8 from skypy.paths import Paths | 8 from skypy.paths import Paths |
9 import subprocess | 9 import subprocess |
10 import requests | 10 import requests |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 self.paths = Paths(os.path.join('out', 'Debug')) | 64 self.paths = Paths(os.path.join('out', 'Debug')) |
65 | 65 |
66 def _start_server(self): | 66 def _start_server(self): |
67 return subprocess.Popen([ | 67 return subprocess.Popen([ |
68 os.path.join(self.paths.sky_tools_directory, 'sky_server'), | 68 os.path.join(self.paths.sky_tools_directory, 'sky_server'), |
69 self.paths.src_root, | 69 self.paths.src_root, |
70 str(HTTP_PORT), | 70 str(HTTP_PORT), |
71 ]) | 71 ]) |
72 | 72 |
73 def _sky_tester_command(self, url): | 73 def _sky_tester_command(self, url): |
74 content_handlers = ['%s,%s' % (mime_type, 'mojo://sky_viewer/') | 74 content_handlers = ['%s,%s' % (mime_type, 'mojo:sky_viewer/') |
75 for mime_type in SUPPORTED_MIME_TYPES] | 75 for mime_type in SUPPORTED_MIME_TYPES] |
76 return [ | 76 return [ |
77 self.paths.mojo_shell_path, | 77 self.paths.mojo_shell_path, |
78 '--args-for=mojo://native_viewport_service/ --use-headless-config --
use-osmesa', | 78 '--args-for=mojo:native_viewport_service/ --use-headless-config --us
e-osmesa', |
79 '--args-for=mojo://window_manager/ %s' % url, | 79 '--args-for=mojo:window_manager/ %s' % url, |
80 '--content-handlers=%s' % ','.join(content_handlers), | 80 '--content-handlers=%s' % ','.join(content_handlers), |
81 '--url-mappings=mojo:window_manager=mojo://sky_tester/', | 81 '--url-mappings=mojo:window_manager=mojo:sky_tester/', |
82 'mojo:window_manager', | 82 'mojo:window_manager', |
83 ] | 83 ] |
84 | 84 |
85 | 85 |
86 def main(self): | 86 def main(self): |
87 test = 'http://localhost:9999/sky/benchmarks/layout/simple-blocks.sky' | 87 test = 'http://localhost:9999/sky/benchmarks/layout/simple-blocks.sky' |
88 | 88 |
89 self._start_server() | 89 self._start_server() |
90 output = subprocess.check_output(self._sky_tester_command(test)) | 90 output = subprocess.check_output(self._sky_tester_command(test)) |
91 values = values_from_output(output) | 91 values = values_from_output(output) |
92 json = create_json_blob(values) | 92 json = create_json_blob(values) |
93 send_json_to_dashboard(json) | 93 send_json_to_dashboard(json) |
94 | 94 |
95 def shutdown(self): | 95 def shutdown(self): |
96 if self._sky_server: | 96 if self._sky_server: |
97 self._sky_server.terminate() | 97 self._sky_server.terminate() |
98 | 98 |
99 | 99 |
100 if __name__ == '__main__': | 100 if __name__ == '__main__': |
101 harness = PerfHarness() | 101 harness = PerfHarness() |
102 try: | 102 try: |
103 harness.main() | 103 harness.main() |
104 except (KeyboardInterrupt, SystemExit): | 104 except (KeyboardInterrupt, SystemExit): |
105 pass | 105 pass |
106 finally: | 106 finally: |
107 harness.shutdown() | 107 harness.shutdown() |
OLD | NEW |