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

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

Issue 1254363004: Move ownership of AppSorting from ExtensionPrefs to ExtensionSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing include Created 5 years, 4 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
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_TEST_EXTENSION_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ 6 #define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "extensions/browser/extension_system.h" 10 #include "extensions/browser/extension_system.h"
11 #include "extensions/common/one_shot_event.h" 11 #include "extensions/common/one_shot_event.h"
12 12
13 class Profile; 13 class Profile;
14 class TestingValueStore; 14 class TestingValueStore;
15 15
16 namespace base { 16 namespace base {
17 class CommandLine; 17 class CommandLine;
18 class FilePath; 18 class FilePath;
19 class Time;
20 } 19 }
21 20
22 namespace content { 21 namespace content {
23 class BrowserContext; 22 class BrowserContext;
24 } 23 }
25 24
26 namespace extensions { 25 namespace extensions {
27 class ExtensionPrefs;
28 class InstallVerifier;
29 class RuntimeData;
30 class SharedUserScriptMaster;
31 class StandardManagementPolicyProvider;
32 26
33 // Test ExtensionSystem, for use with TestingProfile. 27 // Test ExtensionSystem, for use with TestingProfile.
34 class TestExtensionSystem : public ExtensionSystem { 28 class TestExtensionSystem : public ExtensionSystem {
35 public: 29 public:
36 explicit TestExtensionSystem(Profile* profile); 30 explicit TestExtensionSystem(Profile* profile);
37 ~TestExtensionSystem() override; 31 ~TestExtensionSystem() override;
38 32
39 // KeyedService implementation. 33 // KeyedService implementation.
40 void Shutdown() override; 34 void Shutdown() override;
41 35
42 // Creates an ExtensionPrefs with the testing profile and returns it.
43 // Useful for tests that need to modify prefs before creating the
44 // ExtensionService.
45 scoped_ptr<ExtensionPrefs> CreateExtensionPrefs(
46 const base::CommandLine* command_line,
47 const base::FilePath& install_directory);
48
49 // Creates an ExtensionService initialized with the testing profile and 36 // Creates an ExtensionService initialized with the testing profile and
50 // returns it, and creates ExtensionPrefs if it hasn't been created yet. 37 // returns it, and creates ExtensionPrefs if it hasn't been created yet.
51 ExtensionService* CreateExtensionService( 38 ExtensionService* CreateExtensionService(
52 const base::CommandLine* command_line, 39 const base::CommandLine* command_line,
53 const base::FilePath& install_directory, 40 const base::FilePath& install_directory,
54 bool autoupdate_enabled); 41 bool autoupdate_enabled);
55 42
56 void CreateSocketManager(); 43 void CreateSocketManager();
57 44
58 void InitForRegularProfile(bool extensions_enabled) override {} 45 void InitForRegularProfile(bool extensions_enabled) override {}
59 void SetExtensionService(ExtensionService* service); 46 void SetExtensionService(ExtensionService* service);
60 ExtensionService* extension_service() override; 47 ExtensionService* extension_service() override;
61 RuntimeData* runtime_data() override; 48 RuntimeData* runtime_data() override;
62 ManagementPolicy* management_policy() override; 49 ManagementPolicy* management_policy() override;
63 SharedUserScriptMaster* shared_user_script_master() override; 50 SharedUserScriptMaster* shared_user_script_master() override;
64 StateStore* state_store() override; 51 StateStore* state_store() override;
65 StateStore* rules_store() override; 52 StateStore* rules_store() override;
66 TestingValueStore* value_store() { return value_store_; } 53 TestingValueStore* value_store() { return value_store_; }
67 InfoMap* info_map() override; 54 InfoMap* info_map() override;
68 QuotaService* quota_service() override; 55 QuotaService* quota_service() override;
56 AppSorting* app_sorting() override;
69 const OneShotEvent& ready() const override; 57 const OneShotEvent& ready() const override;
70 ContentVerifier* content_verifier() override; 58 ContentVerifier* content_verifier() override;
71 scoped_ptr<ExtensionSet> GetDependentExtensions( 59 scoped_ptr<ExtensionSet> GetDependentExtensions(
72 const Extension* extension) override; 60 const Extension* extension) override;
73 61
74 // Note that you probably want to use base::RunLoop().RunUntilIdle() right 62 // Note that you probably want to use base::RunLoop().RunUntilIdle() right
75 // after this to run all the accumulated tasks. 63 // after this to run all the accumulated tasks.
76 void SetReady() { ready_.Signal(); } 64 void SetReady() { ready_.Signal(); }
77 65
78 // Factory method for tests to use with SetTestingProfile. 66 // Factory method for tests to use with SetTestingProfile.
79 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile); 67 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile);
80 68
69 // Used by ExtensionPrefsTest to re-create the AppSorting after it has
70 // re-created the ExtensionPrefs instance (this can never happen in non-test
71 // code).
72 void RecreateAppSorting();
73
81 protected: 74 protected:
82 Profile* profile_; 75 Profile* profile_;
83 76
84 private: 77 private:
85 scoped_ptr<StateStore> state_store_; 78 scoped_ptr<StateStore> state_store_;
86 // A pointer to the TestingValueStore owned by |state_store_|. 79 // A pointer to the TestingValueStore owned by |state_store_|.
87 TestingValueStore* value_store_; 80 TestingValueStore* value_store_;
88 scoped_ptr<ManagementPolicy> management_policy_; 81 scoped_ptr<ManagementPolicy> management_policy_;
89 scoped_ptr<RuntimeData> runtime_data_; 82 scoped_ptr<RuntimeData> runtime_data_;
90 scoped_ptr<ExtensionService> extension_service_; 83 scoped_ptr<ExtensionService> extension_service_;
91 scoped_refptr<InfoMap> info_map_; 84 scoped_refptr<InfoMap> info_map_;
92 scoped_ptr<QuotaService> quota_service_; 85 scoped_ptr<QuotaService> quota_service_;
86 scoped_ptr<AppSorting> app_sorting_;
93 OneShotEvent ready_; 87 OneShotEvent ready_;
94 }; 88 };
95 89
96 } // namespace extensions 90 } // namespace extensions
97 91
98 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_ 92 #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SYSTEM_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/test_extension_prefs.cc ('k') | chrome/browser/extensions/test_extension_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698