summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 13:27:44 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 13:27:44 +0000
commit6b46031bc0d3071f6fdbd2c42ee8916454997662 (patch)
treec5dcf3a45f05c05d5ff519e8bd0362e5af3e59f3 /net/tools
parent171416b18e75a2de585fd3932a8c0883e9d19b05 (diff)
downloadchromium_src-6b46031bc0d3071f6fdbd2c42ee8916454997662.zip
chromium_src-6b46031bc0d3071f6fdbd2c42ee8916454997662.tar.gz
chromium_src-6b46031bc0d3071f6fdbd2c42ee8916454997662.tar.bz2
chrome.experimental.downloads.download works for non-GET methods.
This wasn't working because ResourceDispatcherHost::BeginDownload was overriding the method. I traced through all callers of BeginDownload and confirmed that the method did not need to be set. BUG=110044 TEST=DownloadsApiTest.Downloads [the downloadPost test case] Review URL: http://codereview.chromium.org/9148070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rwxr-xr-xnet/tools/testserver/testserver.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 35a08c4..b116e2e 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -382,7 +382,8 @@ class TestPageHandler(BasePageHandler):
post_handlers = [
self.EchoTitleHandler,
self.EchoHandler,
- self.DeviceManagementHandler] + get_handlers
+ self.DeviceManagementHandler,
+ self.PostOnlyFileHandler] + get_handlers
put_handlers = [
self.EchoTitleHandler,
self.EchoHandler] + get_handlers
@@ -904,15 +905,23 @@ class TestPageHandler(BasePageHandler):
def FileHandler(self):
"""This handler sends the contents of the requested file. Wow, it's like
a real webserver!"""
-
prefix = self.server.file_root_url
if not self.path.startswith(prefix):
return False
-
# Consume a request body if present.
if self.command == 'POST' or self.command == 'PUT' :
self.ReadRequestBody()
+ return self._FileHandlerHelper(prefix)
+
+ def PostOnlyFileHandler(self):
+ """This handler sends the contents of the requested file on a POST."""
+ prefix = self.server.file_root_url + '/post/'
+ if not self.path.startswith(prefix):
+ return False
+ self.ReadRequestBody()
+ return self._FileHandlerHelper(prefix)
+ def _FileHandlerHelper(self, prefix):
_, _, url_path, _, query, _ = urlparse.urlparse(self.path)
sub_path = url_path[len(prefix):]
entries = sub_path.split('/')