Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: chrome/browser/extensions/test_extension_prefs.h

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 14
15 class DictionaryValue;
16 class ExtensionPrefs; 15 class ExtensionPrefs;
17 class ExtensionPrefValueMap; 16 class ExtensionPrefValueMap;
18 class PrefService; 17 class PrefService;
19 18
19 namespace base {
20 class DictionaryValue;
21 }
22
20 // This is a test class intended to make it easier to work with ExtensionPrefs 23 // This is a test class intended to make it easier to work with ExtensionPrefs
21 // in tests. 24 // in tests.
22 class TestExtensionPrefs { 25 class TestExtensionPrefs {
23 public: 26 public:
24 TestExtensionPrefs(); 27 TestExtensionPrefs();
25 virtual ~TestExtensionPrefs(); 28 virtual ~TestExtensionPrefs();
26 29
27 ExtensionPrefs* prefs() { return prefs_.get(); } 30 ExtensionPrefs* prefs() { return prefs_.get(); }
28 const ExtensionPrefs& const_prefs() const { return *prefs_.get(); } 31 const ExtensionPrefs& const_prefs() const { return *prefs_.get(); }
29 PrefService* pref_service() { return pref_service_.get(); } 32 PrefService* pref_service() { return pref_service_.get(); }
30 const FilePath& temp_dir() const { return temp_dir_.path(); } 33 const FilePath& temp_dir() const { return temp_dir_.path(); }
31 34
32 // This will cause the ExtensionPrefs to be deleted and recreated, based on 35 // This will cause the ExtensionPrefs to be deleted and recreated, based on
33 // any existing backing file we had previously created. 36 // any existing backing file we had previously created.
34 void RecreateExtensionPrefs(); 37 void RecreateExtensionPrefs();
35 38
36 // Creates a new Extension with the given name in our temp dir, adds it to 39 // Creates a new Extension with the given name in our temp dir, adds it to
37 // our ExtensionPrefs, and returns it. 40 // our ExtensionPrefs, and returns it.
38 scoped_refptr<Extension> AddExtension(std::string name); 41 scoped_refptr<Extension> AddExtension(std::string name);
39 42
40 // Similar to AddExtension, but takes a dictionary with manifest values. 43 // Similar to AddExtension, but takes a dictionary with manifest values.
41 scoped_refptr<Extension> AddExtensionWithManifest( 44 scoped_refptr<Extension> AddExtensionWithManifest(
42 const DictionaryValue& manifest, Extension::Location location); 45 const base::DictionaryValue& manifest, Extension::Location location);
43 46
44 // Similar to AddExtension, this adds a new test Extension. This is useful for 47 // Similar to AddExtension, this adds a new test Extension. This is useful for
45 // cases when you don't need the Extension object, but just the id it was 48 // cases when you don't need the Extension object, but just the id it was
46 // assigned. 49 // assigned.
47 std::string AddExtensionAndReturnId(std::string name); 50 std::string AddExtensionAndReturnId(std::string name);
48 51
49 PrefService* CreateIncognitoPrefService() const; 52 PrefService* CreateIncognitoPrefService() const;
50 53
51 protected: 54 protected:
52 ScopedTempDir temp_dir_; 55 ScopedTempDir temp_dir_;
53 FilePath preferences_file_; 56 FilePath preferences_file_;
54 FilePath extensions_dir_; 57 FilePath extensions_dir_;
55 scoped_ptr<PrefService> pref_service_; 58 scoped_ptr<PrefService> pref_service_;
56 scoped_ptr<ExtensionPrefs> prefs_; 59 scoped_ptr<ExtensionPrefs> prefs_;
57 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; 60 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
58 61
59 private: 62 private:
60 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs); 63 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs);
61 }; 64 };
62 65
63 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_ 66 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698