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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 11828040: Revert 175971 (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
« no previous file with comments | « content/public/common/url_constants.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
===================================================================
--- content/renderer/render_view_browsertest.cc (revision 176042)
+++ content/renderer/render_view_browsertest.cc (working copy)
@@ -96,11 +96,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,
@@ -110,6 +110,28 @@
}
};
+class WebUITestClient : public ShellContentClient {
+ public:
+ WebUITestClient() {
+ }
+
+ virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
+ return url.SchemeIs(chrome::kChromeUIScheme);
+ }
+};
+
+class WebUITestBrowserClient : public ShellContentBrowserClient {
+ public:
+ WebUITestBrowserClient() {}
+
+ virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE {
+ return &factory_;
+ }
+
+ private:
+ WebUITestWebUIControllerFactory factory_;
+};
+
} // namespace
class RenderViewImplTest : public RenderViewTest {
@@ -320,9 +342,15 @@
}
TEST_F(RenderViewImplTest, DecideNavigationPolicy) {
- WebUITestWebUIControllerFactory factory;
- WebUIControllerFactory::RegisterFactory(&factory);
+ WebUITestClient client;
+ WebUITestBrowserClient browser_client;
+ ContentClient* old_client = GetContentClient();
+ ContentBrowserClient* old_browser_client = GetContentClient()->browser();
+ SetContentClient(&client);
+ GetContentClient()->set_browser_for_testing(&browser_client);
+ client.set_renderer_for_testing(old_client->renderer());
+
// Navigations to normal HTTP URLs can be handled locally.
WebKit::WebURLRequest request(GURL("http://foo.com"));
WebKit::WebNavigationPolicy policy = view()->decidePolicyForNavigation(
@@ -356,6 +384,9 @@
WebKit::WebNavigationPolicyNewForegroundTab,
false);
EXPECT_EQ(WebKit::WebNavigationPolicyIgnore, policy);
+
+ GetContentClient()->set_browser_for_testing(old_browser_client);
+ SetContentClient(old_client);
}
TEST_F(RenderViewImplTest, DecideNavigationPolicyForWebUI) {
« no previous file with comments | « content/public/common/url_constants.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698