blob: 151f8ee2eacc6418ba86d3f56fdd692fbf763b29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (c) 2012 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.
#ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
#define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
#pragma once
#include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h"
namespace extensions {
// This is a trivial test RulesRegistry that can only store and retrieve rules.
class TestRulesRegistry : public RulesRegistryWithCache {
public:
TestRulesRegistry();
void SetOwnerThread(content::BrowserThread::ID owner_thread);
// RulesRegistryWithCache implementation:
virtual std::string AddRulesImpl(
const std::string& extension_id,
const std::vector<linked_ptr<RulesRegistry::Rule> >& rules) OVERRIDE;
virtual std::string RemoveRulesImpl(
const std::string& extension_id,
const std::vector<std::string>& rule_identifiers) OVERRIDE;
virtual std::string RemoveAllRulesImpl(
const std::string& extension_id) OVERRIDE;
virtual content::BrowserThread::ID GetOwnerThread() const OVERRIDE;
// Sets the result message that will be returned by the next call of
// AddRulesImpl, RemoveRulesImpl and RemoveAllRulesImpl.
void SetResult(const std::string& result);
protected:
virtual ~TestRulesRegistry();
private:
// The string that gets returned by the implementation functions of
// RulesRegistryWithCache. Defaults to "".
std::string result_;
content::BrowserThread::ID owner_thread_;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_TEST_RULES_REGISTRY_H__
|