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

Side by Side Diff: chrome/common/extensions/docs/server2/servlet.py

Issue 600073002: Docserver: Run tasks in testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/common/extensions/docs/server2/integration_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 class RequestHeaders(object): 6 class RequestHeaders(object):
7 '''A custom dictionary impementation for headers which ignores the case 7 '''A custom dictionary impementation for headers which ignores the case
8 of requests, since different HTTP libraries seem to mangle them. 8 of requests, since different HTTP libraries seem to mangle them.
9 ''' 9 '''
10 def __init__(self, dict_): 10 def __init__(self, dict_):
(...skipping 15 matching lines...) Expand all
26 class Request(object): 26 class Request(object):
27 '''Request data. 27 '''Request data.
28 ''' 28 '''
29 def __init__(self, path, host, headers, arguments={}): 29 def __init__(self, path, host, headers, arguments={}):
30 self.path = path.lstrip('/') 30 self.path = path.lstrip('/')
31 self.host = host.rstrip('/') 31 self.host = host.rstrip('/')
32 self.headers = RequestHeaders(headers) 32 self.headers = RequestHeaders(headers)
33 self.arguments = arguments 33 self.arguments = arguments
34 34
35 @staticmethod 35 @staticmethod
36 def ForTest(path, host=None, headers=None): 36 def ForTest(path, host=None, headers=None, arguments=None):
37 return Request(path, host or 'http://developer.chrome.com', headers or {}) 37 return Request(path,
38 host or 'http://developer.chrome.com',
39 headers or {},
40 arguments or {})
38 41
39 def __repr__(self): 42 def __repr__(self):
40 return 'Request(path=%s, host=%s, headers=%s)' % ( 43 return 'Request(path=%s, host=%s, headers=%s)' % (
41 self.path, self.host, self.headers) 44 self.path, self.host, self.headers)
42 45
43 def __str__(self): 46 def __str__(self):
44 return repr(self) 47 return repr(self)
45 48
46 class _ContentBuilder(object): 49 class _ContentBuilder(object):
47 '''Builds the response content. 50 '''Builds the response content.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return repr(self) 160 return repr(self)
158 161
159 class Servlet(object): 162 class Servlet(object):
160 def __init__(self, request): 163 def __init__(self, request):
161 self._request = request 164 self._request = request
162 165
163 def Get(self): 166 def Get(self):
164 '''Returns a Response. 167 '''Returns a Response.
165 ''' 168 '''
166 raise NotImplemented() 169 raise NotImplemented()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/integration_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698