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

Side by Side 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: Addressing some of the current CR comments (before moving on to eliminate the pending WebUI). Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/test/histogram_tester.h" 8 #include "base/test/histogram_tester.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 ~RenderFrameHostManagerTestWebUIControllerFactory() override {} 60 ~RenderFrameHostManagerTestWebUIControllerFactory() override {}
61 61
62 void set_should_create_webui(bool should_create_webui) { 62 void set_should_create_webui(bool should_create_webui) {
63 should_create_webui_ = should_create_webui; 63 should_create_webui_ = should_create_webui;
64 } 64 }
65 65
66 // WebUIFactory implementation. 66 // WebUIFactory implementation.
67 WebUIController* CreateWebUIControllerForURL(WebUI* web_ui, 67 WebUIController* CreateWebUIControllerForURL(WebUI* web_ui,
68 const GURL& url) const override { 68 const GURL& url) const override {
69 if (!(should_create_webui_ && HasWebUIScheme(url))) 69 // If WebUI creation is enabled for the test and this is a WebUI URL,
70 return NULL; 70 // returns a new instance.
71 return new WebUIController(web_ui); 71 if (should_create_webui_ && HasWebUIScheme(url))
72 return new WebUIController(web_ui);
73 return nullptr;
72 } 74 }
73 75
74 WebUI::TypeID GetWebUIType(BrowserContext* browser_context, 76 WebUI::TypeID GetWebUIType(BrowserContext* browser_context,
75 const GURL& url) const override { 77 const GURL& url) const override {
78 // If WebUI creation is enabled for the test and this is a WebUI URL,
79 // returns a mock WebUI type.
80 if (should_create_webui_ && HasWebUIScheme(url)) {
81 return const_cast<RenderFrameHostManagerTestWebUIControllerFactory*>(
82 this);
83 }
76 return WebUI::kNoWebUI; 84 return WebUI::kNoWebUI;
77 } 85 }
78 86
79 bool UseWebUIForURL(BrowserContext* browser_context, 87 bool UseWebUIForURL(BrowserContext* browser_context,
80 const GURL& url) const override { 88 const GURL& url) const override {
81 return HasWebUIScheme(url); 89 return HasWebUIScheme(url);
82 } 90 }
83 91
84 bool UseWebUIBindingsForURL(BrowserContext* browser_context, 92 bool UseWebUIBindingsForURL(BrowserContext* browser_context,
85 const GURL& url) const override { 93 const GURL& url) const override {
(...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2589 host1->GetProcess()->sink().ClearMessages(); 2597 host1->GetProcess()->sink().ClearMessages();
2590 host3->GetProcess()->sink().ClearMessages(); 2598 host3->GetProcess()->sink().ClearMessages();
2591 main_test_rfh()->GetRenderWidgetHost()->Blur(); 2599 main_test_rfh()->GetRenderWidgetHost()->Blur();
2592 verify_focus_message(main_test_rfh()->GetProcess(), false, 2600 verify_focus_message(main_test_rfh()->GetProcess(), false,
2593 main_test_rfh()->GetRenderViewHost()->GetRoutingID()); 2601 main_test_rfh()->GetRenderViewHost()->GetRoutingID());
2594 verify_focus_message(host1->GetProcess(), false, proxyB->GetRoutingID()); 2602 verify_focus_message(host1->GetProcess(), false, proxyB->GetRoutingID());
2595 verify_focus_message(host3->GetProcess(), false, proxyC->GetRoutingID()); 2603 verify_focus_message(host3->GetProcess(), false, proxyC->GetRoutingID());
2596 } 2604 }
2597 2605
2598 } // namespace content 2606 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698