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=org.chromium.content_shell_apk.ContentShellActivity') | |
frankf
2013/08/08 01:26:12
You can just use .ContentShellActivity for short.
gkanwar1
2013/08/08 01:33:30
Done.
| |
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', |
370 default='org.chromium.content_shell_apk.ContentShellActivity', | |
frankf
2013/08/08 01:26:12
Let's not have a default at all.
gkanwar1
2013/08/08 01:33:30
Done.
| |
363 help='Name of the activity to start [default: %default].') | 371 help='Name of the activity to start [default: %default].') |
364 option_parser.add_option( | 372 option_parser.add_option( |
365 '--event-count', default=10000, type='int', | 373 '--event-count', default=10000, type='int', |
366 help='Number of events to generate [default: %default].') | 374 help='Number of events to generate [default: %default].') |
367 option_parser.add_option( | 375 option_parser.add_option( |
368 '--category', default='', | 376 '--category', default='', |
369 help='A list of allowed categories [default: %default].') | 377 help='A list of allowed categories [default: %default].') |
frankf
2013/08/08 01:26:12
Don't display the default, it's confusing.
gkanwar1
2013/08/08 01:33:30
Done.
| |
370 option_parser.add_option( | 378 option_parser.add_option( |
371 '--throttle', default=100, type='int', | 379 '--throttle', default=100, type='int', |
372 help='Delay between events (ms) [default: %default]. ') | 380 help='Delay between events (ms) [default: %default]. ') |
373 option_parser.add_option( | 381 option_parser.add_option( |
374 '--seed', type='int', | 382 '--seed', type='int', |
375 help=('Seed value for pseudo-random generator. Same seed value generates ' | 383 help=('Seed value for pseudo-random generator. Same seed value generates ' |
376 'the same sequence of events. Seed is randomized by default.')) | 384 'the same sequence of events. Seed is randomized by default.')) |
377 option_parser.add_option( | 385 option_parser.add_option( |
378 '--extra-args', default='', | 386 '--extra-args', default='', |
379 help=('String of other args to pass to the command verbatim ' | 387 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 | 688 return 0 |
681 command = argv[1] | 689 command = argv[1] |
682 VALID_COMMANDS[command].add_options_func(option_parser) | 690 VALID_COMMANDS[command].add_options_func(option_parser) |
683 options, args = option_parser.parse_args(argv) | 691 options, args = option_parser.parse_args(argv) |
684 return VALID_COMMANDS[command].run_command_func( | 692 return VALID_COMMANDS[command].run_command_func( |
685 command, options, args, option_parser) | 693 command, options, args, option_parser) |
686 | 694 |
687 | 695 |
688 if __name__ == '__main__': | 696 if __name__ == '__main__': |
689 sys.exit(main(sys.argv)) | 697 sys.exit(main(sys.argv)) |
OLD | NEW |