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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/servers/layout_tests_server.py

Issue 2878873002: webkitpy: Rename WebKitFinder to PathFinder (Closed)
Patch Set: 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
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # Copyright (C) 2014 Samsung Electronics. All rights reserved. 2 # Copyright (C) 2014 Samsung Electronics. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 import time 30 import time
31 import json 31 import json
32 import BaseHTTPServer 32 import BaseHTTPServer
33 import subprocess 33 import subprocess
34 from subprocess import STDOUT 34 from subprocess import STDOUT
35 35
36 from webkitpy.common.webkit_finder import WebKitFinder 36 from webkitpy.common.path_finder import PathFinder
37 from webkitpy.common.system.filesystem import FileSystem 37 from webkitpy.common.system.filesystem import FileSystem
38 from webkitpy.tool.servers.reflection_handler import ReflectionHandler 38 from webkitpy.tool.servers.reflection_handler import ReflectionHandler
39 39
40 40
41 class LayoutTestsHTTPServer(BaseHTTPServer.HTTPServer): 41 class LayoutTestsHTTPServer(BaseHTTPServer.HTTPServer):
42 42
43 def __init__(self, httpd_port, _): 43 def __init__(self, httpd_port, _):
44 server_address = ('', httpd_port) 44 server_address = ('', httpd_port)
45 BaseHTTPServer.HTTPServer.__init__(self, server_address, LayoutTestsServ erHTTPRequestHandler) 45 BaseHTTPServer.HTTPServer.__init__(self, server_address, LayoutTestsServ erHTTPRequestHandler)
46 46
47 47
48 class LayoutTestsServerHTTPRequestHandler(ReflectionHandler): 48 class LayoutTestsServerHTTPRequestHandler(ReflectionHandler):
49 49
50 def do_POST(self): 50 def do_POST(self):
51 json_raw_data = self.rfile.read(int(self.headers.getheader('content-leng th'))) 51 json_raw_data = self.rfile.read(int(self.headers.getheader('content-leng th')))
52 json_data = json.loads(json_raw_data) 52 json_data = json.loads(json_raw_data)
53 test_list = '' 53 test_list = ''
54 for each in json_data['tests']: 54 for each in json_data['tests']:
55 test_list += each + ' ' 55 test_list += each + ' '
56 filesystem = FileSystem() 56 filesystem = FileSystem()
57 webkit_finder = WebKitFinder(filesystem) 57 path_finder = PathFinder(filesystem)
58 script_dir = webkit_finder.path_from_tools_scripts() 58 script_dir = path_finder.path_from_tools_scripts()
59 executable_path = script_dir + '/run-webkit-tests' 59 executable_path = script_dir + '/run-webkit-tests'
60 cmd = 'python ' + executable_path + ' --no-show-results ' 60 cmd = 'python ' + executable_path + ' --no-show-results '
61 cmd += test_list 61 cmd += test_list
62 process = subprocess.Popen(cmd, shell=True, cwd=script_dir, env=None, st dout=subprocess.PIPE, stderr=STDOUT) 62 process = subprocess.Popen(cmd, shell=True, cwd=script_dir, env=None, st dout=subprocess.PIPE, stderr=STDOUT)
63 self.send_response(200) 63 self.send_response(200)
64 self.send_header('Access-Control-Allow-Origin', '*') 64 self.send_header('Access-Control-Allow-Origin', '*')
65 self.send_header('Content-type', 'text/html') 65 self.send_header('Content-type', 'text/html')
66 self.end_headers() 66 self.end_headers()
67 while process.poll() is None: 67 while process.poll() is None:
68 html_output = '<br>' + str(process.stdout.readline()) 68 html_output = '<br>' + str(process.stdout.readline())
69 self.wfile.write(html_output) 69 self.wfile.write(html_output)
70 self.wfile.flush() 70 self.wfile.flush()
71 time.sleep(0.05) 71 time.sleep(0.05)
72 process.wait() 72 process.wait()
73 73
74 def do_OPTIONS(self): 74 def do_OPTIONS(self):
75 self.send_response(200, 'ok') 75 self.send_response(200, 'ok')
76 self.send_header('Access-Control-Allow-Origin', '*') 76 self.send_header('Access-Control-Allow-Origin', '*')
77 self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') 77 self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
78 self.send_header('Access-Control-Allow-Headers', 'Content-type') 78 self.send_header('Access-Control-Allow-Headers', 'Content-type')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698