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