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

Unified Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 1352813006: Move WebUI ownership from the RenderFrameHostManager to the RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased and fixed conflicts of the revert of http://crbug.com/1403343002 :/ Created 5 years, 2 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/frame_host/render_frame_host_manager_unittest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc
index 768b59fd4fb469e06597dae1a3bf97d4a722f2ae..bac4f6df8215295e4fe88f03dc88fe333798b34d 100644
--- a/content/browser/frame_host/render_frame_host_manager_unittest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -65,13 +65,21 @@ class RenderFrameHostManagerTestWebUIControllerFactory
// WebUIFactory implementation.
WebUIController* CreateWebUIControllerForURL(WebUI* web_ui,
const GURL& url) const override {
- if (!(should_create_webui_ && HasWebUIScheme(url)))
- return NULL;
- return new WebUIController(web_ui);
+ // If WebUI creation is enabled for the test and this is a WebUI URL,
+ // returns a new instance.
+ if (should_create_webui_ && HasWebUIScheme(url))
+ return new WebUIController(web_ui);
+ return nullptr;
}
WebUI::TypeID GetWebUIType(BrowserContext* browser_context,
const GURL& url) const override {
+ // If WebUI creation is enabled for the test and this is a WebUI URL,
+ // returns a mock WebUI type.
+ if (should_create_webui_ && HasWebUIScheme(url)) {
+ return const_cast<RenderFrameHostManagerTestWebUIControllerFactory*>(
+ this);
+ }
return WebUI::kNoWebUI;
}

Powered by Google App Engine
This is Rietveld 408576698