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

Unified Diff: tools/android/loading/sandwich_utils.py

Issue 2112483002: sandwich: Fixes two sources of KeyError task failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Egor's comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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.
« tools/android/loading/sandwich_prefetch.py ('K') | « tools/android/loading/sandwich_prefetch.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698