Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / search / tools / instant_extended_manual_tests.py
blob322f7521e91130d5b54e98ff670fe9d787328e6b
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.
6 """Records or runs web-page-replay data for InstantExtendedManualTests.*.
7 Typical usage is:
9 $ cd src/chrome/test/data/search/tools/
10 $ sudo instant_extended_manual_tests.py record \
11 ../../../../../third_party/webpagereplay/replay.py \
12 ../../../../../out/Debug/interactive_ui_tests \
13 ../replay/archive.wpr
15 This will create the archive.wpr file against the lastest google.com GWS.
16 The tests then can be isolated from the live site by replaying this captured
17 session on the bots.
19 This archive.wpr file should be re-recorded and checked into the repo whenever
20 new manual tests are created.
21 """
23 import signal
24 import subprocess
25 import sys
27 def Usage():
28 print 'Usage: sudo python instant_extended_manual_tests.py (record|run) \\'
29 print ' <path/to/replay> <path/to/ui_tests> <path/to/data>'
30 return 1
32 def ReplayTests(replay_path, test_path, data_path, arg=None):
33 # Start up web-page-replay.
34 if not arg:
35 p = subprocess.Popen([replay_path, data_path])
36 else:
37 p = subprocess.Popen([replay_path, arg, data_path])
39 # Run the tests within the mock server.
40 return_value = subprocess.call(
41 [test_path,
42 '--gtest_filter=InstantExtendedManualTest.*',
43 '--run-manual',
44 '--enable-benchmarking',
45 '--enable-stats-table',
46 '--ignore-certificate-errors'])
48 # Shut down web-page-replay and save the recorded session to |data_path|.
49 p.send_signal(signal.SIGINT)
50 p.wait()
51 return return_value
53 def main():
54 if len(sys.argv) != 5:
55 return Usage()
57 if sys.argv[1] == 'record':
58 return ReplayTests(sys.argv[2], sys.argv[3], sys.argv[4], '--record')
60 if sys.argv[1] == 'run':
61 return ReplayTests(sys.argv[2], sys.argv[3], sys.argv[4])
63 return Usage()
65 if __name__ == '__main__':
66 sys.exit(main())