| 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 const FilePath& extensions_dir() const { return extensions_dir_; } | 38 const FilePath& extensions_dir() const { return extensions_dir_; } |
| 38 | 39 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // active after calling RecreateExtensionPrefs(). Defaults to false. | 71 // active after calling RecreateExtensionPrefs(). Defaults to false. |
| 71 void set_extensions_disabled(bool extensions_disabled); | 72 void set_extensions_disabled(bool extensions_disabled); |
| 72 | 73 |
| 73 protected: | 74 protected: |
| 74 ScopedTempDir temp_dir_; | 75 ScopedTempDir temp_dir_; |
| 75 FilePath preferences_file_; | 76 FilePath preferences_file_; |
| 76 FilePath extensions_dir_; | 77 FilePath extensions_dir_; |
| 77 scoped_ptr<PrefService> pref_service_; | 78 scoped_ptr<PrefService> pref_service_; |
| 78 scoped_ptr<ExtensionPrefs> prefs_; | 79 scoped_ptr<ExtensionPrefs> prefs_; |
| 79 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 80 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 81 const scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 bool extensions_disabled_; | 84 bool extensions_disabled_; |
| 83 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); | 85 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 } // namespace extensions | 88 } // namespace extensions |
| 87 | 89 |
| 88 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 90 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
| OLD | NEW |