Chromium Code Reviews| 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/message_loop.h" | |
| 11 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 13 | 14 |
| 14 class ExtensionPrefValueMap; | 15 class ExtensionPrefValueMap; |
| 15 class PrefService; | 16 class PrefService; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class DictionaryValue; | 19 class DictionaryValue; |
| 20 class SequencedWorkerPool; | |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace extensions { | 23 namespace extensions { |
| 22 class ExtensionPrefs; | 24 class ExtensionPrefs; |
| 23 | 25 |
| 24 // This is a test class intended to make it easier to work with ExtensionPrefs | 26 // This is a test class intended to make it easier to work with ExtensionPrefs |
| 25 // in tests. | 27 // in tests. |
| 26 class TestExtensionPrefs { | 28 class TestExtensionPrefs { |
| 27 public: | 29 public: |
| 28 TestExtensionPrefs(); | 30 explicit TestExtensionPrefs(base::SequencedWorkerPool* blocking_pool); |
|
akalin
2012/10/18 23:52:24
can you change to take an STR instead? (See my oth
zel
2012/10/19 01:20:32
Done.
| |
| 29 virtual ~TestExtensionPrefs(); | 31 virtual ~TestExtensionPrefs(); |
| 30 | 32 |
| 31 ExtensionPrefs* prefs() { return prefs_.get(); } | 33 ExtensionPrefs* prefs() { return prefs_.get(); } |
| 32 const ExtensionPrefs& const_prefs() const { | 34 const ExtensionPrefs& const_prefs() const { |
| 33 return *prefs_.get(); | 35 return *prefs_.get(); |
| 34 } | 36 } |
| 35 PrefService* pref_service() { return pref_service_.get(); } | 37 PrefService* pref_service() { return pref_service_.get(); } |
| 36 const FilePath& temp_dir() const { return temp_dir_.path(); } | 38 const FilePath& temp_dir() const { return temp_dir_.path(); } |
| 37 | 39 |
| 38 // This will cause the ExtensionPrefs to be deleted and recreated, based on | 40 // 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. | 71 // active after calling RecreateExtensionPrefs(). Defaults to false. |
| 70 void set_extensions_disabled(bool extensions_disabled); | 72 void set_extensions_disabled(bool extensions_disabled); |
| 71 | 73 |
| 72 protected: | 74 protected: |
| 73 ScopedTempDir temp_dir_; | 75 ScopedTempDir temp_dir_; |
| 74 FilePath preferences_file_; | 76 FilePath preferences_file_; |
| 75 FilePath extensions_dir_; | 77 FilePath extensions_dir_; |
| 76 scoped_ptr<PrefService> pref_service_; | 78 scoped_ptr<PrefService> pref_service_; |
| 77 scoped_ptr<ExtensionPrefs> prefs_; | 79 scoped_ptr<ExtensionPrefs> prefs_; |
| 78 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 80 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 81 // A blocking pool that we can use for file operations. | |
| 82 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | |
| 79 | 83 |
| 80 private: | 84 private: |
| 81 bool extensions_disabled_; | 85 bool extensions_disabled_; |
| 82 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); | 86 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 } // namespace extensions | 89 } // namespace extensions |
| 86 | 90 |
| 87 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 91 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
| OLD | NEW |