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

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

Issue 13470005: Refactor the devserver to make it easier to control caching (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cduvall, rebase Created 7 years, 8 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/test_object_store.py
diff --git a/chrome/common/extensions/docs/server2/test_object_store.py b/chrome/common/extensions/docs/server2/test_object_store.py
new file mode 100644
index 0000000000000000000000000000000000000000..d78746224267ddb51ef758efe1114388706b8a01
--- /dev/null
+++ b/chrome/common/extensions/docs/server2/test_object_store.py
@@ -0,0 +1,24 @@
+# Copyright 2013 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 future import Future
+from object_store import ObjectStore
+
+class TestObjectStore(ObjectStore):
+ '''An object store which records its namespace and behaves like a dict, for
+ testing.
+ '''
+ def __init__(self, namespace):
+ self.namespace = namespace
+ self._store = {}
+
+ def SetMulti(self, mapping, **optarg):
+ self._store.update(mapping)
+
+ def GetMulti(self, keys, **optargs):
+ return Future(value=dict((k, v) for k, v in self._store.items()
+ if k in keys))
+
+ def Delete(self, key):
+ del self._store[key]

Powered by Google App Engine
This is Rietveld 408576698