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

Side by Side Diff: components/browser_context_keyed_service/browser_context_keyed_service_factory.h

Issue 189443008: Use TestingProfile::Builder::AddTestingFactory at ChromeRenderViewHostTestHarness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | 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 COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_F ACTORY_H_ 5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_F ACTORY_H_
6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_F ACTORY_H_ 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVICE_F ACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 28 matching lines...) Expand all
39 void SetTestingFactory(content::BrowserContext* context, 39 void SetTestingFactory(content::BrowserContext* context,
40 TestingFactoryFunction factory); 40 TestingFactoryFunction factory);
41 41
42 // Associates |factory| with |context| and immediately returns the created 42 // Associates |factory| with |context| and immediately returns the created
43 // BrowserContextKeyedService. Since the factory will be used immediately, 43 // BrowserContextKeyedService. Since the factory will be used immediately,
44 // it may not be NULL. 44 // it may not be NULL.
45 BrowserContextKeyedService* SetTestingFactoryAndUse( 45 BrowserContextKeyedService* SetTestingFactoryAndUse(
46 content::BrowserContext* context, 46 content::BrowserContext* context,
47 TestingFactoryFunction factory); 47 TestingFactoryFunction factory);
48 48
49 // Removes the testing factory associated with |context|, if there is one.
50 // This can be used by tests that require a service that isn't created for
51 // tests by default (because its factory returns true from
52 // ServiceIsNULLWhileTesting).
53 void RemoveTestingFactory(content::BrowserContext* context);
Paweł Hajdan Jr. 2014/03/07 22:08:12 This can easily make the code harder to follow. Ca
Joao da Silva 2014/03/07 23:29:20 That would be great, can you suggest a way to do i
54
49 protected: 55 protected:
50 // BrowserContextKeyedServiceFactories must communicate with a 56 // BrowserContextKeyedServiceFactories must communicate with a
51 // BrowserContextDependencyManager. For all non-test code, write your subclass 57 // BrowserContextDependencyManager. For all non-test code, write your subclass
52 // constructors like this: 58 // constructors like this:
53 // 59 //
54 // MyServiceFactory::MyServiceFactory() 60 // MyServiceFactory::MyServiceFactory()
55 // : BrowserContextKeyedServiceFactory( 61 // : BrowserContextKeyedServiceFactory(
56 // "MyService", 62 // "MyService",
57 // BrowserContextDependencyManager::GetInstance()) 63 // BrowserContextDependencyManager::GetInstance())
58 // {} 64 // {}
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 BrowserContextKeyedServices mapping_; 123 BrowserContextKeyedServices mapping_;
118 124
119 // The mapping between a BrowserContext and its overridden 125 // The mapping between a BrowserContext and its overridden
120 // TestingFactoryFunction. 126 // TestingFactoryFunction.
121 BrowserContextOverriddenTestingFunctions testing_factories_; 127 BrowserContextOverriddenTestingFunctions testing_factories_;
122 128
123 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory); 129 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory);
124 }; 130 };
125 131
126 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_ 132 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698