| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 # | 6 # |
| 7 | 7 |
| 8 """Script to actually open a browser and perform the test, and reports back with | 8 """Script to actually open a browser and perform the test, and reports back with |
| 9 the result. | 9 the result. |
| 10 """ | 10 """ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return source | 83 return source |
| 84 | 84 |
| 85 def parse_args(): | 85 def parse_args(): |
| 86 parser = optparse.OptionParser() | 86 parser = optparse.OptionParser() |
| 87 parser.add_option('--out', dest='out', | 87 parser.add_option('--out', dest='out', |
| 88 help = 'The path for html output file that we will running our test from',
| 88 help = 'The path for html output file that we will running our test from',
|
| 89 action = 'store', default = '') | 89 action = 'store', default = '') |
| 90 parser.add_option('--browser', dest='browser', | 90 parser.add_option('--browser', dest='browser', |
| 91 help = 'The browser type (default = chrome)', | 91 help = 'The browser type (default = chrome)', |
| 92 action = 'store', default = 'chrome') | 92 action = 'store', default = 'chrome') |
| 93 # TODO(efortuna): Put this back up to 40 sec. Right now it needs to be less | 93 # TODO(efortuna): Put this back up to be more than the default timeout in |
| 94 # than 20 so that when test.dart times out, this script also closes the | 94 # test.dart. Right now it needs to be less than 60 so that when test.dart |
| 95 # browser windows. | 95 # times out, this script also closes the browser windows. |
| 96 parser.add_option('--timeout', dest = 'timeout', | 96 parser.add_option('--timeout', dest = 'timeout', |
| 97 help = 'Amount of time (seconds) to wait before timeout', type = 'int', | 97 help = 'Amount of time (seconds) to wait before timeout', type = 'int', |
| 98 action = 'store', default=18) | 98 action = 'store', default=58) |
| 99 parser.add_option('--perf', dest = 'is_perf', | 99 parser.add_option('--perf', dest = 'is_perf', |
| 100 help = 'Add this flag if we are running a browser performance test', | 100 help = 'Add this flag if we are running a browser performance test', |
| 101 action = 'store_true', default=False) | 101 action = 'store_true', default=False) |
| 102 args, ignored = parser.parse_args() | 102 args, ignored = parser.parse_args() |
| 103 return args.out, args.browser, args.timeout, args.is_perf | 103 return args.out, args.browser, args.timeout, args.is_perf |
| 104 | 104 |
| 105 def Main(): | 105 def Main(): |
| 106 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to | 106 # Note: you need ChromeDriver *in your path* to run Chrome, in addition to |
| 107 # installing Chrome. | 107 # installing Chrome. |
| 108 browser = None | 108 browser = None |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 158 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 159 index = source.find('<body>') | 159 index = source.find('<body>') |
| 160 index += len('<body>') | 160 index += len('<body>') |
| 161 end_index = source.find('<script') | 161 end_index = source.find('<script') |
| 162 print source[index : end_index] | 162 print source[index : end_index] |
| 163 return 1 | 163 return 1 |
| 164 | 164 |
| 165 | 165 |
| 166 if __name__ == "__main__": | 166 if __name__ == "__main__": |
| 167 sys.exit(Main()) | 167 sys.exit(Main()) |
| OLD | NEW |