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_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.h" | 8 #include "base/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 SequencedWorkerPool; | |
akalin
2012/10/19 02:00:51
not needed anymore, right?
zel
2012/10/19 18:45:07
Done.
| |
14 class Value; | 15 class Value; |
15 } | 16 } |
16 | 17 |
17 namespace extensions { | 18 namespace extensions { |
18 class Extension; | 19 class Extension; |
19 | 20 |
20 // Base class for extension preference-related unit tests. | 21 // Base class for extension preference-related unit tests. |
21 class ExtensionPrefsTest : public testing::Test { | 22 class ExtensionPrefsTest : public testing::Test { |
22 public: | 23 public: |
23 ExtensionPrefsTest(); | 24 ExtensionPrefsTest(); |
24 virtual ~ExtensionPrefsTest(); | 25 virtual ~ExtensionPrefsTest(); |
25 | 26 |
26 // This function will get called once, and is the right place to do operations | 27 // This function will get called once, and is the right place to do operations |
27 // on ExtensionPrefs that write data. | 28 // on ExtensionPrefs that write data. |
28 virtual void Initialize() = 0; | 29 virtual void Initialize() = 0; |
29 | 30 |
30 // This function will be called twice - once while the original ExtensionPrefs | 31 // This function will be called twice - once while the original ExtensionPrefs |
31 // object is still alive, and once after recreation. Thus, it tests that | 32 // object is still alive, and once after recreation. Thus, it tests that |
32 // things don't break after any ExtensionPrefs startup work. | 33 // things don't break after any ExtensionPrefs startup work. |
33 virtual void Verify() = 0; | 34 virtual void Verify() = 0; |
34 | 35 |
35 // This function is called to Register preference default values. | 36 // This function is called to Register preference default values. |
36 virtual void RegisterPreferences(); | 37 virtual void RegisterPreferences(); |
37 | 38 |
38 virtual void SetUp() OVERRIDE; | 39 virtual void SetUp() OVERRIDE; |
39 | 40 |
40 virtual void TearDown() OVERRIDE; | 41 virtual void TearDown() OVERRIDE; |
41 | 42 |
42 protected: | 43 protected: |
43 ExtensionPrefs* prefs() { return prefs_.prefs(); } | 44 ExtensionPrefs* prefs() { return prefs_->prefs(); } |
44 | 45 |
45 MessageLoop message_loop_; | 46 MessageLoop message_loop_; |
46 content::TestBrowserThread ui_thread_; | 47 content::TestBrowserThread ui_thread_; |
47 content::TestBrowserThread file_thread_; | 48 content::TestBrowserThread file_thread_; |
48 | 49 |
49 TestExtensionPrefs prefs_; | 50 scoped_ptr<TestExtensionPrefs> prefs_; |
akalin
2012/10/19 02:00:51
why did you make this a scoped_ptr? It looks like
zel
2012/10/19 18:45:07
Done.
| |
50 | 51 |
51 private: | 52 private: |
52 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsTest); | 53 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsTest); |
53 }; | 54 }; |
54 | 55 |
55 class ExtensionPrefsPrepopulatedTest : public ExtensionPrefsTest { | 56 class ExtensionPrefsPrepopulatedTest : public ExtensionPrefsTest { |
56 public: | 57 public: |
57 ExtensionPrefsPrepopulatedTest(); | 58 ExtensionPrefsPrepopulatedTest(); |
58 virtual ~ExtensionPrefsPrepopulatedTest(); | 59 virtual ~ExtensionPrefsPrepopulatedTest(); |
59 | 60 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 | 93 |
93 scoped_refptr<Extension> ext1_scoped_; | 94 scoped_refptr<Extension> ext1_scoped_; |
94 scoped_refptr<Extension> ext2_scoped_; | 95 scoped_refptr<Extension> ext2_scoped_; |
95 scoped_refptr<Extension> ext3_scoped_; | 96 scoped_refptr<Extension> ext3_scoped_; |
96 scoped_refptr<Extension> ext4_scoped_; | 97 scoped_refptr<Extension> ext4_scoped_; |
97 }; | 98 }; |
98 | 99 |
99 } // namespace extensions | 100 } // namespace extensions |
100 | 101 |
101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_ | 102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_ |
OLD | NEW |