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

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

Issue 600073002: Docserver: Run tasks in testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | chrome/common/extensions/docs/server2/integration_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 def IsDeadlineExceededError(error): 5 def IsDeadlineExceededError(error):
6 '''A general way of determining whether |error| is a DeadlineExceededError, 6 '''A general way of determining whether |error| is a DeadlineExceededError,
7 since there are 3 different types thrown by AppEngine and we might as well 7 since there are 3 different types thrown by AppEngine and we might as well
8 handle them all the same way. For more info see: 8 handle them all the same way. For more info see:
9 https://developers.google.com/appengine/articles/deadlineexceedederrors 9 https://developers.google.com/appengine/articles/deadlineexceedederrors
10 ''' 10 '''
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return _RPC() 270 return _RPC()
271 271
272 @staticmethod 272 @staticmethod
273 def put_async(value): 273 def put_async(value):
274 db._store[value.key] = value 274 db._store[value.key] = value
275 return _RPC() 275 return _RPC()
276 276
277 class BlobReferenceProperty(object): 277 class BlobReferenceProperty(object):
278 pass 278 pass
279 279
280 class FakeTaskQueue(object): 280 # Executes any queued tasks synchronously as they are queued.
281 _task_runner = None
282
283 def SetTaskRunnerForTest(task_runner):
284 global _task_runner
285 _task_runner = task_runner
286
287 class SynchronousTaskQueue(object):
281 class Task(object): 288 class Task(object):
282 def __init__(self, url=None, params={}): 289 def __init__(self, url=None, params={}):
283 pass 290 self.url_ = url
291 self.params_ = params
292
293 def GetUrl(self):
294 return self.url_
295
296 def GetCommit(self):
297 return self.params_.get('commit')
284 298
285 class Queue(object): 299 class Queue(object):
286 def __init__(self, name='default'): 300 def __init__(self, name='default'):
287 pass 301 pass
288 302
289 def add(self, task): 303 def add(self, task):
304 global _task_runner
305 if _task_runner:
306 _task_runner(task.GetUrl(), task.GetCommit())
290 return _RPC() 307 return _RPC()
291 308
292 def purge(self): 309 def purge(self):
293 return _RPC() 310 return _RPC()
294 311
295 taskqueue = FakeTaskQueue() 312 taskqueue = SynchronousTaskQueue()
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698