OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 glob | 6 import glob |
7 import optparse | 7 import optparse |
8 import os.path | 8 import os.path |
9 import socket | 9 import socket |
10 import sys | 10 import sys |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 # Tests, such as run_inbrowser_trusted_crash_in_startup_test, may not use the | 204 # Tests, such as run_inbrowser_trusted_crash_in_startup_test, may not use the |
205 # RunFromCommand line entry point - and otherwise get stuck in an infinite | 205 # RunFromCommand line entry point - and otherwise get stuck in an infinite |
206 # loop when something goes wrong and the hard timeout is not set. | 206 # loop when something goes wrong and the hard timeout is not set. |
207 # http://code.google.com/p/chromium/issues/detail?id=105406 | 207 # http://code.google.com/p/chromium/issues/detail?id=105406 |
208 if options.hard_timeout is None: | 208 if options.hard_timeout is None: |
209 options.hard_timeout = options.timeout * 4 | 209 options.hard_timeout = options.timeout * 4 |
210 | 210 |
211 options.files.append(os.path.join(script_dir, 'browserdata', 'nacltest.js')) | 211 options.files.append(os.path.join(script_dir, 'browserdata', 'nacltest.js')) |
212 | 212 |
213 # Setup the environment with the setuid sandbox path. | 213 # Setup the environment with the setuid sandbox path. |
214 test_env.enable_sandbox_if_required(os.environ) | 214 test_env.enable_sandbox_if_required(sys.argv, os.environ) |
215 | 215 |
216 # Create server | 216 # Create server |
217 host = GetHostName() | 217 host = GetHostName() |
218 try: | 218 try: |
219 server = browsertester.server.Create(host, options.port) | 219 server = browsertester.server.Create(host, options.port) |
220 except Exception: | 220 except Exception: |
221 sys.stdout.write('Could not bind %r, falling back to localhost.\n' % host) | 221 sys.stdout.write('Could not bind %r, falling back to localhost.\n' % host) |
222 server = browsertester.server.Create('localhost', options.port) | 222 server = browsertester.server.Create('localhost', options.port) |
223 | 223 |
224 # If port 0 has been requested, an arbitrary port will be bound so we need to | 224 # If port 0 has been requested, an arbitrary port will be bound so we need to |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 # Validate the URL | 395 # Validate the URL |
396 url = options.url | 396 url = options.url |
397 if url is None: | 397 if url is None: |
398 parser.error('Must specify a URL') | 398 parser.error('Must specify a URL') |
399 | 399 |
400 return Run(url, options) | 400 return Run(url, options) |
401 | 401 |
402 | 402 |
403 if __name__ == '__main__': | 403 if __name__ == '__main__': |
404 sys.exit(RunFromCommandLine()) | 404 sys.exit(RunFromCommandLine()) |
OLD | NEW |