| Index: content/browser/site_instance_impl_unittest.cc
|
| ===================================================================
|
| --- content/browser/site_instance_impl_unittest.cc (revision 176042)
|
| +++ content/browser/site_instance_impl_unittest.cc (working copy)
|
| @@ -15,7 +15,7 @@
|
| #include "content/browser/site_instance_impl.h"
|
| #include "content/browser/web_contents/navigation_entry_impl.h"
|
| #include "content/browser/web_contents/web_contents_impl.h"
|
| -#include "content/browser/webui/web_ui_controller_factory_registry.h"
|
| +#include "content/public/browser/web_ui_controller_factory.h"
|
| #include "content/public/common/content_client.h"
|
| #include "content/public/common/content_constants.h"
|
| #include "content/public/common/content_switches.h"
|
| @@ -47,11 +47,11 @@
|
| }
|
| virtual bool UseWebUIForURL(BrowserContext* browser_context,
|
| const GURL& url) const OVERRIDE {
|
| - return HasWebUIScheme(url);
|
| + return GetContentClient()->HasWebUIScheme(url);
|
| }
|
| virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context,
|
| const GURL& url) const OVERRIDE {
|
| - return HasWebUIScheme(url);
|
| + return GetContentClient()->HasWebUIScheme(url);
|
| }
|
| virtual bool IsURLAcceptableForWebUI(
|
| BrowserContext* browser_context,
|
| @@ -61,15 +61,24 @@
|
| }
|
| };
|
|
|
| +class SiteInstanceTestClient : public TestContentClient {
|
| + public:
|
| + SiteInstanceTestClient() {
|
| + }
|
| +
|
| + virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
|
| + return url.SchemeIs(chrome::kChromeUIScheme);
|
| + }
|
| +};
|
| +
|
| class SiteInstanceTestBrowserClient : public TestContentBrowserClient {
|
| public:
|
| SiteInstanceTestBrowserClient()
|
| : privileged_process_id_(-1) {
|
| - WebUIControllerFactory::RegisterFactory(&factory_);
|
| }
|
|
|
| - ~SiteInstanceTestBrowserClient() {
|
| - WebUIControllerFactoryRegistry::UnregisterFactoryForTesting(&factory_);
|
| + virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE {
|
| + return &factory_;
|
| }
|
|
|
| virtual bool IsSuitableHost(RenderProcessHost* process_host,
|
| @@ -94,11 +103,14 @@
|
| file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING,
|
| &message_loop_),
|
| io_thread_(BrowserThread::IO, &message_loop_),
|
| + old_client_(NULL),
|
| old_browser_client_(NULL) {
|
| }
|
|
|
| virtual void SetUp() {
|
| + old_client_ = GetContentClient();
|
| old_browser_client_ = GetContentClient()->browser();
|
| + SetContentClient(&client_);
|
| GetContentClient()->set_browser_for_testing(&browser_client_);
|
| url_util::AddStandardScheme(kPrivilegedScheme);
|
| url_util::AddStandardScheme(chrome::kChromeUIScheme);
|
| @@ -109,6 +121,7 @@
|
| EXPECT_TRUE(RenderProcessHost::AllHostsIterator().IsAtEnd());
|
|
|
| GetContentClient()->set_browser_for_testing(old_browser_client_);
|
| + SetContentClient(old_client_);
|
|
|
| // http://crbug.com/143565 found SiteInstanceTest leaking an
|
| // AppCacheDatabase. This happens because some part of the test indirectly
|
| @@ -140,7 +153,9 @@
|
| TestBrowserThread file_user_blocking_thread_;
|
| TestBrowserThread io_thread_;
|
|
|
| + SiteInstanceTestClient client_;
|
| SiteInstanceTestBrowserClient browser_client_;
|
| + ContentClient* old_client_;
|
| ContentBrowserClient* old_browser_client_;
|
| };
|
|
|
|
|