summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 08:54:35 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 08:54:35 +0000
commit90079b72590644bfc1e4611fa9f92742c849d90c (patch)
tree78e9e0d5509a9dcca1e4064b3598351709dab8d3 /net/tools
parentf7319fca43949bf9c8b78a18d34721424eee1b3c (diff)
downloadchromium_src-90079b72590644bfc1e4611fa9f92742c849d90c.zip
chromium_src-90079b72590644bfc1e4611fa9f92742c849d90c.tar.gz
chromium_src-90079b72590644bfc1e4611fa9f92742c849d90c.tar.bz2
Fix error reporting in the test server.
We were still using the error protobuf field in the response message, but this has meanwhile been replace by HTTP status codes. BUG=none TEST=toy server successfully generates error response upon invalid/unspecified DM tokens in policy requests Review URL: http://codereview.chromium.org/6883224 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/testserver/device_management.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/tools/testserver/device_management.py b/net/tools/testserver/device_management.py
index bb5cb39..0bf7df3a 100644
--- a/net/tools/testserver/device_management.py
+++ b/net/tools/testserver/device_management.py
@@ -512,7 +512,7 @@ class RequestHandler(object):
the client. Otherwise the first element is the same structure that is
returned by LookupToken().
"""
- error = None
+ error = 500
dmtoken = None
request_device_id = self.GetUniqueParam('deviceid')
match = re.match('GoogleDMToken token=(\\w+)',
@@ -520,22 +520,19 @@ class RequestHandler(object):
if match:
dmtoken = match.group(1)
if not dmtoken:
- error = dm.DeviceManagementResponse.DEVICE_MANAGEMENT_TOKEN_INVALID
+ error = 401
else:
token_info = self._server.LookupToken(dmtoken)
if (not token_info or
not request_device_id or
token_info['device_id'] != request_device_id):
- error = dm.DeviceManagementResponse.DEVICE_NOT_FOUND
+ error = 901
else:
return (token_info, None)
- response = dm.DeviceManagementResponse()
- response.error = error
-
- self.DumpMessage('Response', response)
+ logging.debug('Token check failed with error %d' % error)
- return (None, (200, response.SerializeToString()))
+ return (None, (error, 'Server error %d' % error))
def DumpMessage(self, label, msg):
"""Helper for logging an ASCII dump of a protobuf message."""