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

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

Issue 1695018: Adding ExtensionPrefs methods for storing update-when-idle data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
7
8 #include <string>
9
10 #include "base/scoped_ptr.h"
11 #include "base/scoped_temp_dir.h"
12
13 class DictionaryValue;
14 class Extension;
15 class ExtensionPrefs;
16 class PrefService;
17
18
19 // This is a test class intended to make it easier to work with ExtensionPrefs
20 // in tests.
21 class TestExtensionPrefs {
22 public:
23 TestExtensionPrefs();
24 virtual ~TestExtensionPrefs();
25
26 ExtensionPrefs* prefs() { return prefs_.get(); }
27 PrefService* pref_service() { return pref_service_.get(); }
28 const FilePath& temp_dir() const { return temp_dir_.path(); }
29
30 // This will cause the ExtensionPrefs to be deleted and recreated, based on
31 // any existing backing file we had previously created.
32 void RecreateExtensionPrefs();
33
34 // Creates a new Extension with the given name in our temp dir, adds it to
35 // our ExtensionPrefs, and returns it.
36 Extension* AddExtension(std::string name);
37
38 // Similar to AddExtension, but takes a dictionary with manifest values.
39 Extension* AddExtensionWithManifest(const DictionaryValue& manifest);
40
41 // Similar to AddExtension, this adds a new test Extension. This is useful for
42 // cases when you don't need the Extension object, but just the id it was
43 // assigned.
44 std::string AddExtensionAndReturnId(std::string name);
45
46 protected:
47 ScopedTempDir temp_dir_;
48 FilePath preferences_file_;
49 FilePath extensions_dir_;
50 scoped_ptr<PrefService> pref_service_;
51 scoped_ptr<ExtensionPrefs> prefs_;
52
53 private:
54 DISALLOW_COPY_AND_ASSIGN(TestExtensionPrefs);
55 };
56
57 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.cc ('k') | chrome/browser/extensions/test_extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698