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

Unified Diff: chrome/browser/extensions/settings/settings_test_util.h

Issue 8497065: Extension Settings API: make it so that when leveldb storage areas fail to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/browser/extensions/settings/settings_test_util.h
diff --git a/chrome/browser/extensions/settings/settings_test_util.h b/chrome/browser/extensions/settings/settings_test_util.h
index bad77a5f558e985b6ba45aff8224ee59f8d0110b..9129db9262c9bd955eb21c0689b71ca2f0f2b239 100644
--- a/chrome/browser/extensions/settings/settings_test_util.h
+++ b/chrome/browser/extensions/settings/settings_test_util.h
@@ -1,3 +1,5 @@
+//
+//
// Copyright (c) 2011 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.
@@ -12,14 +14,16 @@
#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/settings/settings_storage_factory.h"
#include "chrome/browser/extensions/test_extension_service.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/test/base/testing_profile.h"
-class SettingsFrontend;
-
namespace extensions {
+class SettingsFrontend;
+class SettingsStorage;
+
// Utilities for extension settings API tests.
namespace settings_test_util {
@@ -63,6 +67,45 @@ class MockProfile : public TestingProfile {
scoped_ptr<ExtensionEventRouter> event_router_;
};
+// A SettingsStorageFactory which delegates to other factories.
+class DelegatingSettingsStorageFactory : public SettingsStorageFactory {
+ public:
+ // Creates with an initial delegate.
+ DelegatingSettingsStorageFactory(
+ // Ownership taken.
+ SettingsStorageFactory* delegate);
+
+ virtual ~DelegatingSettingsStorageFactory();
+
+ // Sets the delegate for Create calls. The existing delegate is deleted.
+ void Reset(
+ // Ownership taken.
+ SettingsStorageFactory* delegate);
+
+ // SettingsStorageFactory implementation.
+ virtual SettingsStorage* Create(
+ const FilePath& base_path, const std::string& extension_id) OVERRIDE;
+
+ private:
+ scoped_ptr<SettingsStorageFactory> delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(DelegatingSettingsStorageFactory);
+};
+
+// A SettingsStorageFactory which always returns NULL.
+class NullSettingsStorageFactory : public SettingsStorageFactory {
+ public:
+ NullSettingsStorageFactory() {}
+ virtual ~NullSettingsStorageFactory() {}
+
+ // SettingsStorageFactory implementation.
+ virtual SettingsStorage* Create(
+ const FilePath& base_path, const std::string& extension_id) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NullSettingsStorageFactory);
+};
+
} // namespace settings_test_util
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698