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

Unified Diff: chrome/browser/prerender/prerender_manager_factory.h

Issue 2304953002: NoState Prefetch: nostate prefetch browser tests. (Closed)
Patch Set: histogram tests Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_manager_factory.h
diff --git a/chrome/browser/prerender/prerender_manager_factory.h b/chrome/browser/prerender/prerender_manager_factory.h
index 46e7e67f2db756bb316e4ada0a1de322763340b4..b56a166e61a1b5b5c60f6b0e864d5a4f4f868243 100644
--- a/chrome/browser/prerender/prerender_manager_factory.h
+++ b/chrome/browser/prerender/prerender_manager_factory.h
@@ -30,6 +30,17 @@ class PrerenderManagerFactory : public BrowserContextKeyedServiceFactory {
static PrerenderManagerFactory* GetInstance();
+ // As the prerender manager gets used very early in browser creation (eg, by
+ // the prerender tab helper), we can't use
+ // KeyedServiceFactory::SetTestingFactory, as the PrerenderManager has been
+ // created already by the time in-process browser tests are able to see a
+ // profile.
droger 2016/09/22 14:54:58 I don't think this is accurate. BuildServiceInsta
mattcary 2016/09/23 07:33:18 I think this issue is specific to the in-process b
droger 2016/09/23 08:15:36 My point is: - if the prerender manager is create
+ using PrerenderCreateFunction = PrerenderManager*(Profile*);
droger 2016/09/23 09:09:33 We don't need a profile here, BrowserContext is en
+ static void set_testing_create_function(
+ PrerenderCreateFunction create_function) {
+ testing_create_function_ = create_function;
+ }
+
private:
friend struct base::DefaultSingletonTraits<PrerenderManagerFactory>;
@@ -41,6 +52,8 @@ class PrerenderManagerFactory : public BrowserContextKeyedServiceFactory {
content::BrowserContext* profile) const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
+
+ static PrerenderCreateFunction* testing_create_function_;
};
} // namespace prerender

Powered by Google App Engine
This is Rietveld 408576698