OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Runs all types of tests from one unified interface. | 7 """Runs all types of tests from one unified interface. |
8 | 8 |
9 TODO(gkanwar): | 9 TODO(gkanwar): |
10 * Add options to run Monkey tests. | 10 * Add options to run Monkey tests. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 options.test_data, | 350 options.test_data, |
351 options.save_perf_json, | 351 options.save_perf_json, |
352 options.screenshot_failures, | 352 options.screenshot_failures, |
353 options.uiautomator_jar, | 353 options.uiautomator_jar, |
354 options.uiautomator_info_jar, | 354 options.uiautomator_info_jar, |
355 options.package_name) | 355 options.package_name) |
356 | 356 |
357 | 357 |
358 def AddMonkeyTestOptions(option_parser): | 358 def AddMonkeyTestOptions(option_parser): |
359 """Adds monkey test options to |option_parser|.""" | 359 """Adds monkey test options to |option_parser|.""" |
| 360 |
| 361 option_parser.usage = '%prog monkey [options]' |
| 362 option_parser.command_list = [] |
| 363 option_parser.example = ( |
| 364 '%prog monkey --package-name=org.chromium.content_shell_apk' |
| 365 ' --activity-name=.ContentShellActivity') |
| 366 |
360 option_parser.add_option('--package-name', help='Allowed package.') | 367 option_parser.add_option('--package-name', help='Allowed package.') |
361 option_parser.add_option( | 368 option_parser.add_option( |
362 '--activity-name', default='com.google.android.apps.chrome.Main', | 369 '--activity-name', help='Name of the activity to start.') |
363 help='Name of the activity to start [default: %default].') | |
364 option_parser.add_option( | 370 option_parser.add_option( |
365 '--event-count', default=10000, type='int', | 371 '--event-count', default=10000, type='int', |
366 help='Number of events to generate [default: %default].') | 372 help='Number of events to generate [default: %default].') |
367 option_parser.add_option( | 373 option_parser.add_option( |
368 '--category', default='', | 374 '--category', default='', |
369 help='A list of allowed categories [default: %default].') | 375 help='A list of allowed categories.') |
370 option_parser.add_option( | 376 option_parser.add_option( |
371 '--throttle', default=100, type='int', | 377 '--throttle', default=100, type='int', |
372 help='Delay between events (ms) [default: %default]. ') | 378 help='Delay between events (ms) [default: %default]. ') |
373 option_parser.add_option( | 379 option_parser.add_option( |
374 '--seed', type='int', | 380 '--seed', type='int', |
375 help=('Seed value for pseudo-random generator. Same seed value generates ' | 381 help=('Seed value for pseudo-random generator. Same seed value generates ' |
376 'the same sequence of events. Seed is randomized by default.')) | 382 'the same sequence of events. Seed is randomized by default.')) |
377 option_parser.add_option( | 383 option_parser.add_option( |
378 '--extra-args', default='', | 384 '--extra-args', default='', |
379 help=('String of other args to pass to the command verbatim ' | 385 help=('String of other args to pass to the command verbatim ' |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 return 0 | 686 return 0 |
681 command = argv[1] | 687 command = argv[1] |
682 VALID_COMMANDS[command].add_options_func(option_parser) | 688 VALID_COMMANDS[command].add_options_func(option_parser) |
683 options, args = option_parser.parse_args(argv) | 689 options, args = option_parser.parse_args(argv) |
684 return VALID_COMMANDS[command].run_command_func( | 690 return VALID_COMMANDS[command].run_command_func( |
685 command, options, args, option_parser) | 691 command, options, args, option_parser) |
686 | 692 |
687 | 693 |
688 if __name__ == '__main__': | 694 if __name__ == '__main__': |
689 sys.exit(main(sys.argv)) | 695 sys.exit(main(sys.argv)) |
OLD | NEW |