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

Unified Diff: extensions/browser/api/storage/settings_test_util.h

Issue 472343003: Use ApiUnitTest for storage API tests (storage_api_unittest and storage_frontend_unittest). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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: extensions/browser/api/storage/settings_test_util.h
diff --git a/extensions/browser/api/storage/settings_test_util.h b/extensions/browser/api/storage/settings_test_util.h
index ee3e64caf7d96742c6406fe0087938ec78b222e4..82dd53965662ba79d99f2b6edeb60f02f65121cb 100644
--- a/extensions/browser/api/storage/settings_test_util.h
+++ b/extensions/browser/api/storage/settings_test_util.h
@@ -12,11 +12,11 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/test/base/testing_profile.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/settings_storage_factory.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/mock_extension_system.h"
#include "extensions/common/extension.h"
class ValueStore;
@@ -27,6 +27,12 @@ class StorageFrontend;
// Utilities for extension settings API tests.
namespace settings_test_util {
+// Creates a kilobyte of data.
+scoped_ptr<base::Value> CreateKilobyte();
+
+// Creates a megabyte of data.
+scoped_ptr<base::Value> CreateMegabyte();
+
// Synchronously gets the storage area for an extension from |frontend|.
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
settings_namespace::Namespace setting_namespace,
@@ -36,39 +42,36 @@ ValueStore* GetStorage(scoped_refptr<const Extension> extension,
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
StorageFrontend* frontend);
-// Creates an extension with |id| and adds it to the registry for |profile|.
-scoped_refptr<const Extension> AddExtensionWithId(Profile* profile,
- const std::string& id,
- Manifest::Type type);
+// Creates an extension with |id| and adds it to the registry for |context|.
+scoped_refptr<const Extension> AddExtensionWithId(
+ content::BrowserContext* context,
+ const std::string& id,
+ Manifest::Type type);
// Creates an extension with |id| with a set of |permissions| and adds it to
-// the registry for |profile|.
+// the registry for |context|.
scoped_refptr<const Extension> AddExtensionWithIdAndPermissions(
- Profile* profile,
+ content::BrowserContext* context,
const std::string& id,
Manifest::Type type,
const std::set<std::string>& permissions);
-// A mock ExtensionSystem to serve an EventRouter.
-class MockExtensionSystem : public TestExtensionSystem {
+// A MockExtensionSystem to serve an EventRouter.
+class MockExtensionSystemWithEventRouter : public MockExtensionSystem {
public:
- explicit MockExtensionSystem(Profile* profile);
- virtual ~MockExtensionSystem();
+ explicit MockExtensionSystemWithEventRouter(content::BrowserContext* context);
+ virtual ~MockExtensionSystemWithEventRouter();
+
+ // Factory method for SetTestingFactoryAndUse.
+ static KeyedService* Build(content::BrowserContext* context);
+ // MockExtensionSystem overrides:
virtual EventRouter* event_router() OVERRIDE;
private:
scoped_ptr<EventRouter> event_router_;
- DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem);
-};
-
-// A Profile which returns an ExtensionSystem with enough functionality for
-// the tests.
-class MockProfile : public TestingProfile {
- public:
- explicit MockProfile(const base::FilePath& file_path);
- virtual ~MockProfile();
+ DISALLOW_COPY_AND_ASSIGN(MockExtensionSystemWithEventRouter);
};
// SettingsStorageFactory which acts as a wrapper for other factories.

Powered by Google App Engine
This is Rietveld 408576698