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

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

Issue 108643002: ABANDONED: Remove Chrome dependencies from TestExtensionPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 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_EXTENSION_PREFS_UNITTEST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/extensions/test_extension_prefs.h" 9 #include "chrome/browser/extensions/test_extension_prefs.h"
10 #include "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace base { 13 namespace base {
14 class PrefServiceFactory;
14 class Value; 15 class Value;
15 } 16 }
16 17
17 namespace user_prefs { 18 namespace user_prefs {
18 class PrefRegistrySyncable; 19 class PrefRegistrySyncable;
19 } 20 }
20 21
21 namespace extensions { 22 namespace extensions {
22 class Extension; 23 class Extension;
23 24
24 // Base class for extension preference-related unit tests. 25 // Base class for extension preference-related unit tests.
25 class ExtensionPrefsTest : public testing::Test { 26 class ExtensionPrefsTest : public testing::Test {
26 public: 27 public:
27 ExtensionPrefsTest(); 28 // Takes ownership of and uses |custom_pref_service_factory| if non-NULL;
29 // uses a standard base::PrefServiceFactory otherwise.
30 explicit ExtensionPrefsTest(
31 base::PrefServiceFactory* custom_pref_service_factory);
28 virtual ~ExtensionPrefsTest(); 32 virtual ~ExtensionPrefsTest();
29 33
30 // This function will get called once, and is the right place to do operations 34 // This function will get called once, and is the right place to do operations
31 // on ExtensionPrefs that write data. 35 // on ExtensionPrefs that write data.
32 virtual void Initialize() = 0; 36 virtual void Initialize() = 0;
33 37
34 // This function will be called twice - once while the original ExtensionPrefs 38 // This function will be called twice - once while the original ExtensionPrefs
35 // object is still alive, and once after recreation. Thus, it tests that 39 // object is still alive, and once after recreation. Thus, it tests that
36 // things don't break after any ExtensionPrefs startup work. 40 // things don't break after any ExtensionPrefs startup work.
37 virtual void Verify() = 0; 41 virtual void Verify() = 0;
(...skipping 15 matching lines...) Expand all
53 57
54 private: 58 private:
55 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsTest); 59 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsTest);
56 }; 60 };
57 61
58 62
59 class PrefsPrepopulatedTestBase : public ExtensionPrefsTest { 63 class PrefsPrepopulatedTestBase : public ExtensionPrefsTest {
60 public: 64 public:
61 static const size_t kNumInstalledExtensions = 4; 65 static const size_t kNumInstalledExtensions = 4;
62 66
63 PrefsPrepopulatedTestBase(); 67 PrefsPrepopulatedTestBase(
68 base::PrefServiceFactory* custom_pref_service_factory);
64 virtual ~PrefsPrepopulatedTestBase(); 69 virtual ~PrefsPrepopulatedTestBase();
65 70
66 Extension* extension1() { return extension1_.get(); } 71 Extension* extension1() { return extension1_.get(); }
67 Extension* extension2() { return extension2_.get(); } 72 Extension* extension2() { return extension2_.get(); }
68 Extension* extension3() { return extension3_.get(); } 73 Extension* extension3() { return extension3_.get(); }
69 Extension* extension4() { return extension4_.get(); } 74 Extension* extension4() { return extension4_.get(); }
70 75
71 protected: 76 protected:
72 bool installed_[kNumInstalledExtensions]; 77 bool installed_[kNumInstalledExtensions];
73 78
74 scoped_refptr<Extension> extension1_; 79 scoped_refptr<Extension> extension1_;
75 scoped_refptr<Extension> extension2_; 80 scoped_refptr<Extension> extension2_;
76 scoped_refptr<Extension> extension3_; 81 scoped_refptr<Extension> extension3_;
77 scoped_refptr<Extension> extension4_; 82 scoped_refptr<Extension> extension4_;
78 83
79 private: 84 private:
80 DISALLOW_COPY_AND_ASSIGN(PrefsPrepopulatedTestBase); 85 DISALLOW_COPY_AND_ASSIGN(PrefsPrepopulatedTestBase);
81 }; 86 };
82 87
83 } // namespace extensions 88 } // namespace extensions
84 89
85 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_ 90 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698