OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SETTINGS_SETTINGS_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/linked_ptr.h" |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/extensions/extension_event_router.h" | 15 #include "chrome/browser/extensions/extension_event_router.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/settings/settings_storage_factory.h" | 17 #include "chrome/browser/extensions/settings/settings_storage_factory.h" |
16 #include "chrome/browser/extensions/test_extension_service.h" | 18 #include "chrome/browser/extensions/test_extension_service.h" |
17 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
19 | 21 |
20 | 22 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 64 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
63 | 65 |
64 private: | 66 private: |
65 MockExtensionService extension_service_; | 67 MockExtensionService extension_service_; |
66 scoped_ptr<ExtensionEventRouter> event_router_; | 68 scoped_ptr<ExtensionEventRouter> event_router_; |
67 }; | 69 }; |
68 | 70 |
69 // SettingsStorageFactory which acts as a wrapper for other factories. | 71 // SettingsStorageFactory which acts as a wrapper for other factories. |
70 class ScopedSettingsStorageFactory : public SettingsStorageFactory { | 72 class ScopedSettingsStorageFactory : public SettingsStorageFactory { |
71 public: | 73 public: |
72 explicit ScopedSettingsStorageFactory(SettingsStorageFactory* delegate); | 74 ScopedSettingsStorageFactory(); |
73 | 75 |
74 virtual ~ScopedSettingsStorageFactory(); | 76 explicit ScopedSettingsStorageFactory( |
| 77 const scoped_refptr<SettingsStorageFactory>& delegate); |
75 | 78 |
76 // Sets the delegate factory (equivalent to scoped_ptr::reset). | 79 // Sets the delegate factory (equivalent to scoped_ptr::reset). |
77 void Reset(SettingsStorageFactory* delegate); | 80 void Reset(const scoped_refptr<SettingsStorageFactory>& delegate); |
78 | 81 |
79 // SettingsStorageFactory implementation. | 82 // SettingsStorageFactory implementation. |
80 virtual SettingsStorage* Create( | 83 virtual SettingsStorage* Create( |
81 const FilePath& base_path, const std::string& extension_id) OVERRIDE; | 84 const FilePath& base_path, const std::string& extension_id) OVERRIDE; |
82 | 85 |
83 private: | 86 private: |
84 scoped_ptr<SettingsStorageFactory> delegate_; | 87 // SettingsStorageFactory is refcounted. |
| 88 virtual ~ScopedSettingsStorageFactory(); |
| 89 |
| 90 scoped_refptr<SettingsStorageFactory> delegate_; |
85 }; | 91 }; |
86 | 92 |
87 } // namespace settings_test_util | 93 } // namespace settings_test_util |
88 | 94 |
89 } // namespace extensions | 95 } // namespace extensions |
90 | 96 |
91 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_TEST_UTIL_H_ |
OLD | NEW |