Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / extensions / extension_prefs_unittest.h
blob432d262f544d83d475a527551f15456ac0e4456a
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_
8 #include "base/message_loop/message_loop.h"
9 #include "chrome/browser/extensions/test_extension_prefs.h"
10 #include "content/public/test/test_browser_thread.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace base {
14 class Value;
17 namespace user_prefs {
18 class PrefRegistrySyncable;
21 namespace extensions {
22 class ChromeAppSorting;
23 class Extension;
25 // Base class for extension preference-related unit tests.
26 class ExtensionPrefsTest : public testing::Test {
27 public:
28 ExtensionPrefsTest();
29 ~ExtensionPrefsTest() override;
31 // This function will get called once, and is the right place to do operations
32 // on ExtensionPrefs that write data.
33 virtual void Initialize() = 0;
35 // This function will be called twice - once while the original ExtensionPrefs
36 // object is still alive, and once after recreation. Thus, it tests that
37 // things don't break after any ExtensionPrefs startup work.
38 virtual void Verify() = 0;
40 // This function is called to Register preference default values.
41 virtual void RegisterPreferences(user_prefs::PrefRegistrySyncable* registry);
43 void SetUp() override;
45 void TearDown() override;
47 protected:
48 ExtensionPrefs* prefs() { return prefs_.prefs(); }
49 ChromeAppSorting* app_sorting() { return prefs_.app_sorting(); }
51 base::MessageLoop message_loop_;
52 content::TestBrowserThread ui_thread_;
54 TestExtensionPrefs prefs_;
56 private:
57 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefsTest);
61 class PrefsPrepopulatedTestBase : public ExtensionPrefsTest {
62 public:
63 static const size_t kNumInstalledExtensions = 4;
65 PrefsPrepopulatedTestBase();
66 ~PrefsPrepopulatedTestBase() override;
68 Extension* extension1() { return extension1_.get(); }
69 Extension* extension2() { return extension2_.get(); }
70 Extension* extension3() { return extension3_.get(); }
71 Extension* extension4() { return extension4_.get(); }
73 protected:
74 bool installed_[kNumInstalledExtensions];
76 scoped_refptr<Extension> extension1_;
77 scoped_refptr<Extension> extension2_;
78 scoped_refptr<Extension> extension3_;
79 scoped_refptr<Extension> extension4_;
81 private:
82 DISALLOW_COPY_AND_ASSIGN(PrefsPrepopulatedTestBase);
85 } // namespace extensions
87 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_UNITTEST_H_