[email protected] | 19cbf13 | 2013-07-10 13:10:23 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | """Simple script which asks user to manually check result of bisection. |
| 7 | |
| 8 | Typically used as by the run-bisect-manual-test.py script. |
| 9 | """ |
| 10 | |
| 11 | import os |
| 12 | import sys |
| 13 | |
| 14 | sys.path.append(os.path.join(os.path.dirname(__file__), 'telemetry')) |
| 15 | from telemetry.core import browser_finder |
| 16 | from telemetry.core import browser_options |
| 17 | |
| 18 | |
| 19 | def _StartManualTest(options): |
| 20 | """Start browser then ask the user whether build is good or bad.""" |
| 21 | browser_to_create = browser_finder.FindBrowser(options) |
| 22 | print 'Starting browser: %s.' % options.browser_type |
| 23 | with browser_to_create.Create() as browser: |
| 24 | |
| 25 | # Loop until we get a response that we can parse. |
| 26 | while True: |
| 27 | sys.stderr.write('Revision is [(g)ood/(b)ad]: ') |
| 28 | response = raw_input() |
| 29 | if response and response in ('g', 'b'): |
| 30 | if response in ('g'): |
| 31 | print "RESULT manual_test: manual_test= 1" |
| 32 | else: |
| 33 | print "RESULT manual_test: manual_test= 0" |
| 34 | break |
| 35 | |
| 36 | browser.Close() |
| 37 | |
| 38 | |
| 39 | def main(): |
| 40 | usage = ('%prog [options]\n' |
| 41 | 'Starts browser with an optional url and asks user whether ' |
| 42 | 'revision is good or bad.\n') |
| 43 | |
| 44 | options = browser_options.BrowserOptions() |
| 45 | parser = options.CreateParser(usage) |
| 46 | options, args = parser.parse_args() |
| 47 | |
| 48 | _StartManualTest(options) |
| 49 | |
| 50 | |
| 51 | if __name__ == '__main__': |
| 52 | sys.exit(main()) |