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 EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
8 #include "extensions/browser/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 int rules_registry_id
);
18 TestRulesRegistry(content::BrowserContext
* browser_context
,
19 const std::string
& event_name
,
20 content::BrowserThread::ID owner_thread
,
21 RulesCacheDelegate
* cache_delegate
,
22 int rules_registry_id
);
24 // RulesRegistry implementation:
25 std::string
AddRulesImpl(
26 const std::string
& extension_id
,
27 const std::vector
<linked_ptr
<api::events::Rule
>>& rules
) override
;
28 std::string
RemoveRulesImpl(
29 const std::string
& extension_id
,
30 const std::vector
<std::string
>& rule_identifiers
) override
;
31 std::string
RemoveAllRulesImpl(const std::string
& extension_id
) override
;
33 // Sets the result message that will be returned by the next call of
34 // AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl.
35 void SetResult(const std::string
& result
);
38 ~TestRulesRegistry() override
;
41 // The string that gets returned by the implementation functions of
42 // RulesRegistry. Defaults to "".
45 DISALLOW_COPY_AND_ASSIGN(TestRulesRegistry
);
48 } // namespace extensions
50 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_TEST_RULES_REGISTRY_H__