OLD | NEW |
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """This package contains utility methods for manipulating paths and | 5 """This package contains utility methods for manipulating paths and |
6 filenames for test results and baselines. It also contains wrappers | 6 filenames for test results and baselines. It also contains wrappers |
7 of a few routines in platform_utils.py so that platform_utils.py can | 7 of a few routines in platform_utils.py so that platform_utils.py can |
8 be considered a 'protected' package - i.e., this file should be | 8 be considered a 'protected' package - i.e., this file should be |
9 the only file that ever includes platform_utils. This leads to | 9 the only file that ever includes platform_utils. This leads to |
10 us including a few things that don't really have anything to do | 10 us including a few things that don't really have anything to do |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 def _WinPathToUnix(path): | 174 def _WinPathToUnix(path): |
175 """Convert a windows path to use unix-style path separators (a/b/c).""" | 175 """Convert a windows path to use unix-style path separators (a/b/c).""" |
176 return path.replace('\\', '/') | 176 return path.replace('\\', '/') |
177 | 177 |
178 # | 178 # |
179 # Routines that are arguably platform-specific but have been made | 179 # Routines that are arguably platform-specific but have been made |
180 # generic for now (they used to be in platform_utils_*) | 180 # generic for now (they used to be in platform_utils_*) |
181 # | 181 # |
182 def FilenameToUri(full_path): | 182 def FilenameToUri(full_path): |
183 """Convert a test file to a URI.""" | 183 """Convert a test file to a URI.""" |
| 184 LAYOUTTESTS_DIR = "LayoutTests/" |
184 LAYOUTTEST_HTTP_DIR = "LayoutTests/http/tests/" | 185 LAYOUTTEST_HTTP_DIR = "LayoutTests/http/tests/" |
185 PENDING_HTTP_DIR = "pending/http/tests/" | 186 PENDING_HTTP_DIR = "pending/http/tests/" |
186 LAYOUTTEST_WEBSOCKET_DIR = "LayoutTests/websocket/tests/" | 187 LAYOUTTEST_WEBSOCKET_DIR = "LayoutTests/websocket/tests/" |
187 | 188 |
188 relative_path = _WinPathToUnix(RelativeTestFilename(full_path)) | 189 relative_path = _WinPathToUnix(RelativeTestFilename(full_path)) |
189 port = None | 190 port = None |
190 use_ssl = False | 191 use_ssl = False |
191 | 192 |
192 if relative_path.startswith(LAYOUTTEST_HTTP_DIR): | 193 if relative_path.startswith(LAYOUTTEST_HTTP_DIR): |
193 # LayoutTests/http/tests/ run off port 8000 and ssl/ off 8443 | 194 # LayoutTests/http/tests/ run off port 8000 and ssl/ off 8443 |
194 relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):] | 195 relative_path = relative_path[len(LAYOUTTEST_HTTP_DIR):] |
195 port = 8000 | 196 port = 8000 |
196 elif relative_path.startswith(PENDING_HTTP_DIR): | 197 elif relative_path.startswith(PENDING_HTTP_DIR): |
197 # pending/http/tests/ run off port 9000 and ssl/ off 9443 | 198 # pending/http/tests/ run off port 9000 and ssl/ off 9443 |
198 relative_path = relative_path[len(PENDING_HTTP_DIR):] | 199 relative_path = relative_path[len(PENDING_HTTP_DIR):] |
199 port = 9000 | 200 port = 9000 |
200 elif relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR): | 201 elif relative_path.startswith(LAYOUTTEST_WEBSOCKET_DIR): |
201 # LayoutTests/websocket/tests/ run off port 8880 | 202 # LayoutTests/websocket/tests/ run off port 8880 and 9323 |
202 relative_path = relative_path[len(LAYOUTTEST_WEBSOCKET_DIR):] | 203 # Note: the root is LayoutTests/, not LayoutTests/websocket/tests/ |
| 204 relative_path = relative_path[len(LAYOUTTESTS_DIR):] |
203 port = 8880 | 205 port = 8880 |
204 elif relative_path.find("/http/") >= 0: | 206 elif relative_path.find("/http/") >= 0: |
205 # chrome/http/tests run off of port 8081 with the full path | 207 # chrome/http/tests run off of port 8081 with the full path |
206 port = 8081 | 208 port = 8081 |
207 | 209 |
208 # Make LayoutTests/http/tests/local run as local files. This is to mimic the | 210 # Make LayoutTests/http/tests/local run as local files. This is to mimic the |
209 # logic in run-webkit-tests. | 211 # logic in run-webkit-tests. |
210 # TODO(jianli): Consider extending this to "media/". | 212 # TODO(jianli): Consider extending this to "media/". |
211 if port and not relative_path.startswith("local/"): | 213 if port and not relative_path.startswith("local/"): |
212 if relative_path.startswith("ssl/"): | 214 if relative_path.startswith("ssl/"): |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 return platform_utils.LayoutTestHelperPath(target) | 353 return platform_utils.LayoutTestHelperPath(target) |
352 | 354 |
353 def FuzzyMatchPath(): | 355 def FuzzyMatchPath(): |
354 return platform_utils.FuzzyMatchPath() | 356 return platform_utils.FuzzyMatchPath() |
355 | 357 |
356 def ShutDownHTTPServer(server_process): | 358 def ShutDownHTTPServer(server_process): |
357 return platform_utils.ShutDownHTTPServer(server_process) | 359 return platform_utils.ShutDownHTTPServer(server_process) |
358 | 360 |
359 def KillAllTestShells(): | 361 def KillAllTestShells(): |
360 platform_utils.KillAllTestShells() | 362 platform_utils.KillAllTestShells() |
OLD | NEW |