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_TEST_EXTENSION_PREFS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 | 13 |
14 class ExtensionPrefValueMap; | 14 class ExtensionPrefValueMap; |
15 class PrefService; | 15 class PrefService; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 class SequencedTaskRunner; | |
19 } | 20 } |
20 | 21 |
21 namespace extensions { | 22 namespace extensions { |
22 class ExtensionPrefs; | 23 class ExtensionPrefs; |
23 | 24 |
24 // This is a test class intended to make it easier to work with ExtensionPrefs | 25 // This is a test class intended to make it easier to work with ExtensionPrefs |
25 // in tests. | 26 // in tests. |
26 class TestExtensionPrefs { | 27 class TestExtensionPrefs { |
27 public: | 28 public: |
28 TestExtensionPrefs(); | 29 explicit TestExtensionPrefs(base::SequencedTaskRunner* task_runner); |
29 virtual ~TestExtensionPrefs(); | 30 virtual ~TestExtensionPrefs(); |
30 | 31 |
31 ExtensionPrefs* prefs() { return prefs_.get(); } | 32 ExtensionPrefs* prefs() { return prefs_.get(); } |
32 const ExtensionPrefs& const_prefs() const { | 33 const ExtensionPrefs& const_prefs() const { |
33 return *prefs_.get(); | 34 return *prefs_.get(); |
34 } | 35 } |
35 PrefService* pref_service() { return pref_service_.get(); } | 36 PrefService* pref_service() { return pref_service_.get(); } |
36 const FilePath& temp_dir() const { return temp_dir_.path(); } | 37 const FilePath& temp_dir() const { return temp_dir_.path(); } |
37 | 38 |
38 // This will cause the ExtensionPrefs to be deleted and recreated, based on | 39 // This will cause the ExtensionPrefs to be deleted and recreated, based on |
(...skipping 30 matching lines...) Expand all Loading... | |
69 // active after calling RecreateExtensionPrefs(). Defaults to false. | 70 // active after calling RecreateExtensionPrefs(). Defaults to false. |
70 void set_extensions_disabled(bool extensions_disabled); | 71 void set_extensions_disabled(bool extensions_disabled); |
71 | 72 |
72 protected: | 73 protected: |
73 ScopedTempDir temp_dir_; | 74 ScopedTempDir temp_dir_; |
74 FilePath preferences_file_; | 75 FilePath preferences_file_; |
75 FilePath extensions_dir_; | 76 FilePath extensions_dir_; |
76 scoped_ptr<PrefService> pref_service_; | 77 scoped_ptr<PrefService> pref_service_; |
77 scoped_ptr<ExtensionPrefs> prefs_; | 78 scoped_ptr<ExtensionPrefs> prefs_; |
78 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 79 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
80 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
akalin
2012/10/19 23:12:21
const scoped_refptr
zel
2012/10/21 20:03:19
Done.
| |
79 | 81 |
80 private: | 82 private: |
81 bool extensions_disabled_; | 83 bool extensions_disabled_; |
82 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); | 84 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); |
83 }; | 85 }; |
84 | 86 |
85 } // namespace extensions | 87 } // namespace extensions |
86 | 88 |
87 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 89 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
OLD | NEW |