1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
8 #include "chrome/browser/extensions/api/declarative/rules_registry.h"
10 namespace extensions {
12 // This is a trivial test RulesRegistry that can only store and retrieve rules.
13 class TestRulesRegistry : public RulesRegistry {
15 TestRulesRegistry(content::BrowserThread::ID owner_thread,
16 const std::string& event_name,
17 const WebViewKey& webview_key);
20 const std::string& event_name,
21 content::BrowserThread::ID owner_thread,
22 RulesCacheDelegate* cache_delegate,
23 const WebViewKey& webview_key);
25 // RulesRegistry implementation:
26 virtual std::string AddRulesImpl(
27 const std::string& extension_id,
28 const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE;
29 virtual std::string RemoveRulesImpl(
30 const std::string& extension_id,
31 const std::vector<std::string>& rule_identifiers) OVERRIDE;
32 virtual std::string RemoveAllRulesImpl(
33 const std::string& extension_id) OVERRIDE;
35 // Sets the result message that will be returned by the next call of
36 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl.
37 void SetResult(const std::string& result);
40 virtual ~TestRulesRegistry();
43 // The string that gets returned by the implementation functions of
44 // RulesRegistry. Defaults to "".
47 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry);
50 } // namespace extensions
52 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__