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_SERVICE_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 bool profile_is_managed; | 39 bool profile_is_managed; |
40 | 40 |
41 ExtensionServiceInitParams(); | 41 ExtensionServiceInitParams(); |
42 }; | 42 }; |
43 | 43 |
44 ExtensionServiceTestBase(); | 44 ExtensionServiceTestBase(); |
45 virtual ~ExtensionServiceTestBase(); | 45 virtual ~ExtensionServiceTestBase(); |
46 | 46 |
47 void InitializeExtensionService(const ExtensionServiceInitParams& params); | 47 void InitializeExtensionService(const ExtensionServiceInitParams& params); |
48 | 48 |
49 static void InitializeExtensionServiceForProfile( | |
tapted
2013/11/20 11:03:25
should return ExtensionService*
benwells
2013/11/21 00:47:47
yes :)
tapted
2013/11/21 03:29:56
Done.
| |
50 const ExtensionServiceInitParams& params, | |
51 scoped_ptr<TestingProfile>* profile_ptr, | |
52 ExtensionService** service_ptr); | |
53 | |
49 void InitializeInstalledExtensionService( | 54 void InitializeInstalledExtensionService( |
50 const base::FilePath& prefs_file, | 55 const base::FilePath& prefs_file, |
51 const base::FilePath& source_install_dir); | 56 const base::FilePath& source_install_dir); |
52 | 57 |
53 void InitializeGoodInstalledExtensionService(); | 58 void InitializeGoodInstalledExtensionService(); |
54 | 59 |
55 void InitializeEmptyExtensionService(); | 60 void InitializeEmptyExtensionService(); |
56 | 61 |
57 void InitializeProcessManager(); | 62 void InitializeProcessManager(); |
58 | 63 |
59 void InitializeExtensionServiceWithUpdater(); | 64 void InitializeExtensionServiceWithUpdater(); |
60 | 65 |
61 void InitializeExtensionSyncService(); | 66 void InitializeExtensionSyncService(); |
62 | 67 |
63 static void SetUpTestCase(); | 68 static void SetUpTestCase(); |
64 | 69 |
65 virtual void SetUp() OVERRIDE; | 70 virtual void SetUp() OVERRIDE; |
66 virtual void TearDown() OVERRIDE; | 71 virtual void TearDown() OVERRIDE; |
67 | 72 |
68 void set_extensions_enabled(bool enabled) { | 73 void set_extensions_enabled(bool enabled) { |
69 service_->set_extensions_enabled(enabled); | 74 service_->set_extensions_enabled(enabled); |
70 } | 75 } |
71 | 76 |
72 protected: | 77 protected: |
73 ExtensionServiceInitParams CreateDefaultInitParams(); | 78 ExtensionServiceInitParams CreateDefaultInitParams(); |
79 static ExtensionServiceInitParams CreateDefaultInitParamsInTempDir( | |
80 base::ScopedTempDir* temp_dir_); | |
tapted
2013/11/20 11:03:25
temp_dir_ shouldn't have a trailing underscore
tapted
2013/11/21 03:29:56
Done.
| |
74 | 81 |
75 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come | 82 // Destroying at_exit_manager_ will delete all LazyInstances, so it must come |
76 // after thread_bundle_ in the destruction order. | 83 // after thread_bundle_ in the destruction order. |
77 base::ShadowingAtExitManager at_exit_manager_; | 84 base::ShadowingAtExitManager at_exit_manager_; |
78 content::TestBrowserThreadBundle thread_bundle_; | 85 content::TestBrowserThreadBundle thread_bundle_; |
79 base::ScopedTempDir temp_dir_; | 86 base::ScopedTempDir temp_dir_; |
80 scoped_ptr<TestingProfile> profile_; | 87 scoped_ptr<TestingProfile> profile_; |
81 base::FilePath extensions_install_dir_; | 88 base::FilePath extensions_install_dir_; |
82 base::FilePath data_dir_; | 89 base::FilePath data_dir_; |
83 // Managed by extensions::ExtensionSystemFactory. | 90 // Managed by extensions::ExtensionSystemFactory. |
84 ExtensionService* service_; | 91 ExtensionService* service_; |
85 extensions::ManagementPolicy* management_policy_; | 92 extensions::ManagementPolicy* management_policy_; |
86 scoped_ptr<ExtensionSyncService> extension_sync_service_; | 93 scoped_ptr<ExtensionSyncService> extension_sync_service_; |
87 size_t expected_extensions_count_; | 94 size_t expected_extensions_count_; |
88 | 95 |
89 #if defined OS_CHROMEOS | 96 #if defined OS_CHROMEOS |
90 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 97 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
91 chromeos::ScopedTestCrosSettings test_cros_settings_; | 98 chromeos::ScopedTestCrosSettings test_cros_settings_; |
92 chromeos::ScopedTestUserManager test_user_manager_; | 99 chromeos::ScopedTestUserManager test_user_manager_; |
93 #endif | 100 #endif |
94 }; | 101 }; |
95 | 102 |
96 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ | 103 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_UNITTEST_H_ |
OLD | NEW |