Index: tools/android/loading/sandwich_utils.py |
diff --git a/tools/android/loading/sandwich_utils.py b/tools/android/loading/sandwich_utils.py |
index bbc2d9d198c7b98e6bb20fc80c8c7fa3bb9ab20a..406034d1d59f1cda549664b1e26995163d376f06 100644 |
--- a/tools/android/loading/sandwich_utils.py |
+++ b/tools/android/loading/sandwich_utils.py |
@@ -2,12 +2,26 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import re |
+import urlparse |
+ |
import common_util |
import emulation |
import sandwich_runner |
import task_manager |
+class SandwichKnownError(Exception): |
+ pass |
+ |
+ |
+def NormalizeUrl(url): |
pasko
2016/07/04 18:05:58
better inline this function. Called once and the n
gabadie
2016/07/06 08:57:55
I don't think so because it will very probably be
pasko
2016/07/06 12:45:52
Let's not complicate reading before it is necessar
gabadie
2016/07/06 13:31:14
Done.
|
+ """Returns normalized URL with trailing slashes.""" |
+ parsed_url = list(urlparse.urlparse(url)) |
+ parsed_url[2] = re.sub(r"/{2,}", r"/", parsed_url[2]) |
pasko
2016/07/04 18:05:57
single quotes for consistency
gabadie
2016/07/06 08:57:55
Oups... done.
|
+ return urlparse.urlunparse(parsed_url) |
+ |
+ |
def NetworkSimulationTransformer(network_condition): |
"""Creates a function that accepts a SandwichRunner as a parameter and sets |
network emulation options on it. |