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

Unified Diff: content/browser/site_instance_impl_unittest.cc

Issue 11818036: Revert 175822 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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: content/browser/site_instance_impl_unittest.cc
===================================================================
--- content/browser/site_instance_impl_unittest.cc (revision 175856)
+++ 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_;
};
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/web_contents/render_view_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698