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

Unified Diff: chrome/common/extensions/docs/server2/appengine_wrappers.py

Issue 10828042: Extensions Docs Server: Integration testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for CQ Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/appengine_wrappers.py
diff --git a/chrome/common/extensions/docs/server2/appengine_wrappers.py b/chrome/common/extensions/docs/server2/appengine_wrappers.py
new file mode 100644
index 0000000000000000000000000000000000000000..67f6feb71a2446d426158bac16ea723e9a257c0b
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/appengine_wrappers.py
@@ -0,0 +1,33 @@
+# 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.
+
+from in_memory_memcache import InMemoryMemcache
+
+# This will attempt to import the actual Appengine modules, and if it fails,
not at google - send to devlin 2012/07/31 06:04:36 nit: (here an below), it's "App Engine" not "Appen
+# they will be replaced with fake modules. This is useful during testing.
+try:
+ import google.appengine.ext.webapp as webapp
+ import google.appengine.api.memcache as memcache
+ import google.appengine.api.urlfetch as urlfetch
+except ImportError:
+ class FakeUrlFetch(object):
+ def fetch(self, url):
+ raise NotImplementedError()
+
+ def create_rpc(self):
+ raise NotImplementedError()
+
+ def make_fetch_call(self):
+ raise NotImplementedError()
+ urlfetch = FakeUrlFetch()
+
+ # Use an in-memory memcache if Appengine memcache isn't available.
+ memcache = InMemoryMemcache()
+
+ # A fake webapp.RequestHandler class for Handler to extend.
+ class webapp(object):
+ class RequestHandler(object):
+ def __init__(self, request, response):
+ self.request = request
+ self.response = response

Powered by Google App Engine
This is Rietveld 408576698