| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 sel.stop() | 82 sel.stop() |
| 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 |
| 94 # than 20 so that when test.dart times out, this script also closes the |
| 95 # browser windows. |
| 93 parser.add_option('--timeout', dest = 'timeout', | 96 parser.add_option('--timeout', dest = 'timeout', |
| 94 help = 'Amount of time (seconds) to wait before timeout', type = 'int', | 97 help = 'Amount of time (seconds) to wait before timeout', type = 'int', |
| 95 action = 'store', default=40) | 98 action = 'store', default=18) |
| 96 parser.add_option('--perf', dest = 'is_perf', | 99 parser.add_option('--perf', dest = 'is_perf', |
| 97 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', |
| 98 action = 'store_true', default=False) | 101 action = 'store_true', default=False) |
| 99 args, ignored = parser.parse_args() | 102 args, ignored = parser.parse_args() |
| 100 return args.out, args.browser, args.timeout, args.is_perf | 103 return args.out, args.browser, args.timeout, args.is_perf |
| 101 | 104 |
| 102 def Main(): | 105 def Main(): |
| 103 # 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 |
| 104 # installing Chrome. | 107 # installing Chrome. |
| 105 browser = None | 108 browser = None |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #TODO(efortuna): Access these elements in a nicer way using DOM parser. | 155 #TODO(efortuna): Access these elements in a nicer way using DOM parser. |
| 153 index = source.find('<body>') | 156 index = source.find('<body>') |
| 154 index += len('<body>') | 157 index += len('<body>') |
| 155 end_index = source.find('<script') | 158 end_index = source.find('<script') |
| 156 print source[index : end_index] | 159 print source[index : end_index] |
| 157 return 1 | 160 return 1 |
| 158 | 161 |
| 159 | 162 |
| 160 if __name__ == "__main__": | 163 if __name__ == "__main__": |
| 161 sys.exit(Main()) | 164 sys.exit(Main()) |
| OLD | NEW |