OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 class LayoutTestsHTTPServer(BaseHTTPServer.HTTPServer): | 41 class LayoutTestsHTTPServer(BaseHTTPServer.HTTPServer): |
42 def __init__(self, httpd_port, config): | 42 def __init__(self, httpd_port, config): |
43 server_name = "" | 43 server_name = "" |
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 # FIXME : Has to be json object | |
52 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) |
| 53 test_list = '' |
| 54 for each in json_data['tests']: |
| 55 test_list += each + ' ' |
53 filesystem = FileSystem() | 56 filesystem = FileSystem() |
54 webkit_finder = WebKitFinder(filesystem) | 57 webkit_finder = WebKitFinder(filesystem) |
55 script_dir = webkit_finder.path_from_webkit_base('Tools', 'Scripts') | 58 script_dir = webkit_finder.path_from_webkit_base('Tools', 'Scripts') |
56 executable_path = script_dir + "/run-webkit-tests" | 59 executable_path = script_dir + "/run-webkit-tests" |
57 cmd = "python " + executable_path + " --no-show-results " | 60 cmd = "python " + executable_path + " --no-show-results " |
58 cmd += json_raw_data | 61 cmd += test_list |
59 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) |
60 self.send_response(200) | 63 self.send_response(200) |
61 self.send_header('Access-Control-Allow-Origin', '*') | 64 self.send_header('Access-Control-Allow-Origin', '*') |
62 self.send_header("Content-type", "text/html") | 65 self.send_header("Content-type", "text/html") |
63 self.end_headers() | 66 self.end_headers() |
64 while process.poll() is None: | 67 while process.poll() is None: |
65 html_output = '<br>' + str(process.stdout.readline()) | 68 html_output = '<br>' + str(process.stdout.readline()) |
66 self.wfile.write(html_output) | 69 self.wfile.write(html_output) |
67 self.wfile.flush() | 70 self.wfile.flush() |
68 time.sleep(0.05) | 71 time.sleep(0.05) |
69 process.wait() | 72 process.wait() |
70 | 73 |
71 def do_OPTIONS(self): | 74 def do_OPTIONS(self): |
72 self.send_response(200, "ok") | 75 self.send_response(200, "ok") |
73 self.send_header('Access-Control-Allow-Origin', '*') | 76 self.send_header('Access-Control-Allow-Origin', '*') |
74 self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') | 77 self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS') |
75 self.send_header("Access-Control-Allow-Headers", "Content-type") | 78 self.send_header("Access-Control-Allow-Headers", "Content-type") |
OLD | NEW |