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/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/manifest.h" |
13 | 14 |
14 class ExtensionPrefValueMap; | 15 class ExtensionPrefValueMap; |
15 class PrefServiceSyncable; | 16 class PrefServiceSyncable; |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class DictionaryValue; | 19 class DictionaryValue; |
19 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
20 } | 21 } |
21 | 22 |
22 namespace extensions { | 23 namespace extensions { |
| 24 class Extension; |
23 class ExtensionPrefs; | 25 class ExtensionPrefs; |
24 | 26 |
25 // This is a test class intended to make it easier to work with ExtensionPrefs | 27 // This is a test class intended to make it easier to work with ExtensionPrefs |
26 // in tests. | 28 // in tests. |
27 class TestExtensionPrefs { | 29 class TestExtensionPrefs { |
28 public: | 30 public: |
29 explicit TestExtensionPrefs(base::SequencedTaskRunner* task_runner); | 31 explicit TestExtensionPrefs(base::SequencedTaskRunner* task_runner); |
30 virtual ~TestExtensionPrefs(); | 32 virtual ~TestExtensionPrefs(); |
31 | 33 |
32 ExtensionPrefs* prefs() { return prefs_.get(); } | 34 ExtensionPrefs* prefs() { return prefs_.get(); } |
(...skipping 11 matching lines...) Expand all Loading... |
44 // Creates a new Extension with the given name in our temp dir, adds it to | 46 // Creates a new Extension with the given name in our temp dir, adds it to |
45 // our ExtensionPrefs, and returns it. | 47 // our ExtensionPrefs, and returns it. |
46 scoped_refptr<Extension> AddExtension(std::string name); | 48 scoped_refptr<Extension> AddExtension(std::string name); |
47 | 49 |
48 // As above, but the extension is an app. | 50 // As above, but the extension is an app. |
49 scoped_refptr<Extension> AddApp(std::string name); | 51 scoped_refptr<Extension> AddApp(std::string name); |
50 | 52 |
51 // Similar to AddExtension, but takes a dictionary with manifest values. | 53 // Similar to AddExtension, but takes a dictionary with manifest values. |
52 scoped_refptr<Extension> AddExtensionWithManifest( | 54 scoped_refptr<Extension> AddExtensionWithManifest( |
53 const base::DictionaryValue& manifest, | 55 const base::DictionaryValue& manifest, |
54 Extension::Location location); | 56 Manifest::Location location); |
55 | 57 |
56 // Similar to AddExtension, but takes a dictionary with manifest values | 58 // Similar to AddExtension, but takes a dictionary with manifest values |
57 // and extension flags. | 59 // and extension flags. |
58 scoped_refptr<Extension> AddExtensionWithManifestAndFlags( | 60 scoped_refptr<Extension> AddExtensionWithManifestAndFlags( |
59 const base::DictionaryValue& manifest, | 61 const base::DictionaryValue& manifest, |
60 Extension::Location location, | 62 Manifest::Location location, |
61 int extra_flags); | 63 int extra_flags); |
62 | 64 |
63 // Similar to AddExtension, this adds a new test Extension. This is useful for | 65 // Similar to AddExtension, this adds a new test Extension. This is useful for |
64 // cases when you don't need the Extension object, but just the id it was | 66 // cases when you don't need the Extension object, but just the id it was |
65 // assigned. | 67 // assigned. |
66 std::string AddExtensionAndReturnId(std::string name); | 68 std::string AddExtensionAndReturnId(std::string name); |
67 | 69 |
68 PrefServiceSyncable* CreateIncognitoPrefService() const; | 70 PrefServiceSyncable* CreateIncognitoPrefService() const; |
69 | 71 |
70 // Allows disabling the loading of preferences of extensions. Becomes | 72 // Allows disabling the loading of preferences of extensions. Becomes |
(...skipping 10 matching lines...) Expand all Loading... |
81 const scoped_refptr<base::SequencedTaskRunner> task_runner_; | 83 const scoped_refptr<base::SequencedTaskRunner> task_runner_; |
82 | 84 |
83 private: | 85 private: |
84 bool extensions_disabled_; | 86 bool extensions_disabled_; |
85 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); | 87 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace extensions | 90 } // namespace extensions |
89 | 91 |
90 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ |
OLD | NEW |