Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: PerformanceTests/Pywebsocket/resources/generate.py

Issue 738753002: [Pywebsocket PerformanceTests 1/2] Add PerformanceTests/Pywebsocket (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fetch. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 '''Generator script for PerformanceTests/Pywebsocket/. Run
6 $ python resources/generate.py
7 at PerformanceTests/Pywebsocket/, and commit the generated files.'''
8
9 import sys
10 import os
11
12
13 def generate(connection_type,
14 benchmark_name,
15 data_type,
16 is_worker,
17 is_async,
18 does_verify):
19 pywebsocket_server = 'http://localhost:8001'
20
21 test_file_name = ('%s-%s%s-%s-%s-%s.html' %
22 (connection_type,
23 benchmark_name,
24 '' if data_type == '' else '-' + data_type,
25 'worker' if is_worker else 'window',
26 'async' if is_async else 'sync',
27 'verify' if does_verify else 'noverify'))
28
29 test_file_content_template = '''<!DOCTYPE html>
30 <head>
31 <script src="../resources/runner.js"></script>
32 <script src="%s/util.js"></script>
33 <script src="resources/util_performance_test.js"></script>
34 <script src="%s/%s"></script>
35 </head>
36 <body onload="startPerformanceTest(
37 '%s',
38 '%s',
39 '%s',
40 %s,
41 %s,
42 %s)">
43 </body>
44 </html>
45 '''
46
47 test_file_content = (test_file_content_template %
yhirano 2015/08/18 12:50:40 I would prefer |format| function because we can us
hiroshige 2015/08/19 08:58:52 Done.
48 (pywebsocket_server,
49 pywebsocket_server,
50 'benchmark.js' if connection_type == 'WebSocket' else
51 'xhr_benchmark.js' if connection_type == 'XHR' else
52 'fetch_benchmark.js',
53 connection_type,
54 benchmark_name + 'Benchmark',
55 data_type,
56 'true' if is_worker else 'false',
57 'true' if is_async else 'false',
58 'true' if does_verify else 'false'))
59
60 with open(test_file_name, 'w') as f:
61 f.write(test_file_content)
62
63
64 def main():
65 for is_worker in [True, False]:
66 for benchmark_name in ['send', 'receive']:
67 if benchmark_name != 'send':
68 # Disable WebSocket-send tests because it is very slow
69 # without a native module in pywebsocket.
70 generate('WebSocket', benchmark_name, '',
71 is_worker, is_async=True, does_verify=True)
72
73 for data_type in ['arraybuffer', 'blob', 'text']:
74 generate('XHR', benchmark_name, data_type,
75 is_worker, is_async=True, does_verify=True)
76 generate('fetch', benchmark_name, data_type,
77 is_worker, is_async=True, does_verify=True)
78
79 if benchmark_name != 'receive' or is_worker:
80 # Disable XHR-send-*-window-sync tests.
yhirano 2015/08/18 12:50:40 receive?
hiroshige 2015/08/19 08:58:52 Done.
81 for data_type in ['arraybuffer', 'blob', 'text']:
82 generate('XHR', benchmark_name, data_type,
83 is_worker, is_async=False, does_verify=True)
84
85 if __name__ == "__main__":
86 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698