#ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_
#define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_
#include <set>
#include <string>
#include "base/compiler_specific.h"
#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/common/extension.h"
class ValueStore;
namespace extensions {
class StorageFrontend;
namespace settings_test_util {
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
settings_namespace::Namespace setting_namespace,
StorageFrontend* frontend);
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
StorageFrontend* frontend);
scoped_refptr<const Extension> AddExtensionWithId(Profile* profile,
const std::string& id,
Manifest::Type type);
scoped_refptr<const Extension> AddExtensionWithIdAndPermissions(
Profile* profile,
const std::string& id,
Manifest::Type type,
const std::set<std::string>& permissions);
class MockExtensionSystem : public TestExtensionSystem {
public:
explicit MockExtensionSystem(Profile* profile);
virtual ~MockExtensionSystem();
virtual EventRouter* event_router() OVERRIDE;
private:
scoped_ptr<EventRouter> event_router_;
DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem);
};
class MockProfile : public TestingProfile {
public:
explicit MockProfile(const base::FilePath& file_path);
virtual ~MockProfile();
};
class ScopedSettingsStorageFactory : public SettingsStorageFactory {
public:
ScopedSettingsStorageFactory();
explicit ScopedSettingsStorageFactory(
const scoped_refptr<SettingsStorageFactory>& delegate);
void Reset(const scoped_refptr<SettingsStorageFactory>& delegate);
virtual ValueStore* Create(const base::FilePath& base_path,
const std::string& extension_id) OVERRIDE;
virtual void DeleteDatabaseIfExists(
const base::FilePath& base_path,
const std::string& extension_id) OVERRIDE;
private:
virtual ~ScopedSettingsStorageFactory();
scoped_refptr<SettingsStorageFactory> delegate_;
};
}
}
#endif