Index: content/browser/webui/web_ui_mojo_browsertest.cc |
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc |
index 5007a8da6a0872686d63cddb5b2875cf2f694074..8abb3b8d0c32fa12228ca205366e8ddd6e9b682e 100644 |
--- a/content/browser/webui/web_ui_mojo_browsertest.cc |
+++ b/content/browser/webui/web_ui_mojo_browsertest.cc |
@@ -12,12 +12,15 @@ |
#include "base/strings/string_util.h" |
#include "content/browser/webui/web_ui_controller_factory_registry.h" |
#include "content/public/browser/browser_context.h" |
+#include "content/public/browser/render_frame_host.h" |
+#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_ui_controller.h" |
#include "content/public/browser/web_ui_data_source.h" |
#include "content/public/common/content_paths.h" |
#include "content/public/common/content_switches.h" |
+#include "content/public/common/service_registry.h" |
#include "content/public/common/url_utils.h" |
#include "content/public/test/content_browser_test.h" |
#include "content/public/test/content_browser_test_utils.h" |
@@ -125,13 +128,19 @@ class PingTestWebUIController : public TestWebUIController { |
PingTestWebUIController(WebUI* web_ui, base::RunLoop* run_loop) |
: TestWebUIController(web_ui, run_loop) { |
} |
+ virtual ~PingTestWebUIController() {} |
// WebUIController overrides: |
virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE { |
- mojo::MessagePipe pipe; |
- browser_target_.reset( |
- new PingBrowserTargetImpl(pipe.handle0.Pass(), run_loop_)); |
- render_view_host->SetWebUIHandle(pipe.handle1.Pass()); |
+ render_view_host->GetProcess()->ActivateMojo(); |
+ render_view_host->GetMainFrame()->GetServiceRegistry()->AddService( |
+ "webui_controller", |
+ base::Bind(&PingTestWebUIController::CreateHandler, |
+ base::Unretained(this))); |
+ } |
+ |
+ void CreateHandler(mojo::ScopedMessagePipeHandle handle) { |
+ browser_target_.reset(new PingBrowserTargetImpl(handle.Pass(), run_loop_)); |
} |
private: |