summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 18:16:58 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 18:16:58 +0000
commit41610bf6396d6bd1d6f597f0a163a30bb53919cd (patch)
tree335dd7c845d9a68e093de761ee21bc84d2839ebf /net/tools
parent603b3f168d4e6b546ba6c8597fb6d16fe637f88e (diff)
downloadchromium_src-41610bf6396d6bd1d6f597f0a163a30bb53919cd.zip
chromium_src-41610bf6396d6bd1d6f597f0a163a30bb53919cd.tar.gz
chromium_src-41610bf6396d6bd1d6f597f0a163a30bb53919cd.tar.bz2
All SSL UI tests work with ephemeral ports.
This also changes the testserver text replacement hooks to accept base64 encoded pairs, and to support multiple replacement texts. These changes were needed for some of the "ssl/top_frame.html" based tests, which contained a frame with an HTML page referencing three URLs on three tdifferent test servers. BUG=56814 TEST=browser_tests --gtest_filter="*SSLUI*" Review URL: http://codereview.chromium.org/4664009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65819 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-xnet/tools/testserver/testserver.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 53444e3..ccb589b 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -577,20 +577,26 @@ class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def _ReplaceFileData(self, data, query_parameters):
"""Replaces matching substrings in a file.
- If the 'replace_orig' and 'replace_new' URL query parameters are present,
- a new string is returned with all occasions of the 'replace_orig' value
- replaced by the 'replace_new' value.
+ If the 'replace_text' URL query parameter is present, it is expected to be
+ of the form old_text:new_text, which indicates that any old_text strings in
+ the file are replaced with new_text. Multiple 'replace_text' parameters may
+ be specified.
If the parameters are not present, |data| is returned.
"""
query_dict = cgi.parse_qs(query_parameters)
- orig_values = query_dict.get('replace_orig', [])
- new_values = query_dict.get('replace_new', [])
- if not orig_values or not new_values:
- return data
- orig_value = orig_values[0]
- new_value = new_values[0]
- return data.replace(orig_value, new_value)
+ replace_text_values = query_dict.get('replace_text', [])
+ for replace_text_value in replace_text_values:
+ replace_text_args = replace_text_value.split(':')
+ if len(replace_text_args) != 2:
+ raise ValueError(
+ 'replace_text must be of form old_text:new_text. Actual value: %s' %
+ replace_text_value)
+ old_text_b64, new_text_b64 = replace_text_args
+ old_text = base64.urlsafe_b64decode(old_text_b64)
+ new_text = base64.urlsafe_b64decode(new_text_b64)
+ data = data.replace(old_text, new_text)
+ return data
def FileHandler(self):
"""This handler sends the contents of the requested file. Wow, it's like