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

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

Issue 2844633002: Remove blink_perf.pywebsocket tests (Closed)
Patch Set: Rebase Created 3 years, 7 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 test_file_name = ('%s-%s%s-%s-%s-%s.html' %
20 (connection_type,
21 benchmark_name,
22 '' if data_type == '' else '-' + data_type,
23 'worker' if is_worker else 'window',
24 'async' if is_async else 'sync',
25 'verify' if does_verify else 'noverify'))
26
27 test_file_content_template = '''<!DOCTYPE html>
28 <head>
29 <script src="../resources/runner.js"></script>
30 <script src="resources/util_performance_test.js"></script>
31 </head>
32 <body onload="startPerformanceTest(
33 '{connection_type}',
34 '{benchmark_name}Benchmark',
35 '{data_type}',
36 {is_worker},
37 {is_async},
38 {does_verify})">
39 </body>
40 </html>
41 '''
42
43 if connection_type == 'WebSocket':
44 script_name = 'benchmark.js'
45 elif connection_type == 'XHR':
46 script_name = 'xhr_benchmark.js'
47 else:
48 script_name = 'fetch_benchmark.js'
49
50 test_file_content = test_file_content_template.format(
51 script_name=script_name,
52 connection_type=connection_type,
53 benchmark_name=benchmark_name,
54 data_type=data_type,
55 is_worker='true' if is_worker else 'false',
56 is_async='true' if is_async else 'false',
57 does_verify='true' if does_verify else 'false')
58
59 with open(test_file_name, 'w') as f:
60 f.write(test_file_content)
61
62
63 def main():
64 for is_worker in [True, False]:
65 for benchmark_name in ['send', 'receive']:
66 if benchmark_name != 'send':
67 # Disable WebSocket-send tests because it is very slow
68 # without a native module in pywebsocket.
69 generate('WebSocket', benchmark_name, '',
70 is_worker, is_async=True, does_verify=True)
71
72 for data_type in ['arraybuffer', 'blob', 'text']:
73 generate('XHR', benchmark_name, data_type,
74 is_worker, is_async=True, does_verify=True)
75 generate('fetch', benchmark_name, data_type,
76 is_worker, is_async=True, does_verify=True)
77
78 if benchmark_name == 'receive' and not is_worker:
79 # Disable XHR-receive-*-window-sync tests.
80 continue
81
82 for data_type in ['arraybuffer', 'blob', 'text']:
83 generate('XHR', benchmark_name, data_type,
84 is_worker, is_async=False, does_verify=True)
85
86 if __name__ == "__main__":
87 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698