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

Side by Side Diff: content/browser/webui/web_ui_mojo_browsertest.cc

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/vibration_browsertest.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <limits> 5 #include <limits>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "content/browser/webui/web_ui_controller_factory_registry.h" 16 #include "content/browser/webui/web_ui_controller_factory_registry.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/render_view_host.h" 20 #include "content/public/browser/render_view_host.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_ui_controller.h" 22 #include "content/public/browser/web_ui_controller.h"
23 #include "content/public/browser/web_ui_data_source.h" 23 #include "content/public/browser/web_ui_data_source.h"
24 #include "content/public/common/content_paths.h" 24 #include "content/public/common/content_paths.h"
25 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
26 #include "content/public/common/service_registry.h"
27 #include "content/public/common/url_utils.h" 26 #include "content/public/common/url_utils.h"
28 #include "content/public/test/browser_test_utils.h" 27 #include "content/public/test/browser_test_utils.h"
29 #include "content/public/test/content_browser_test.h" 28 #include "content/public/test/content_browser_test.h"
30 #include "content/public/test/content_browser_test_utils.h" 29 #include "content/public/test/content_browser_test_utils.h"
31 #include "content/shell/browser/shell.h" 30 #include "content/shell/browser/shell.h"
32 #include "content/test/data/web_ui_test_mojo_bindings.mojom.h" 31 #include "content/test/data/web_ui_test_mojo_bindings.mojom.h"
33 #include "mojo/public/cpp/bindings/binding.h" 32 #include "mojo/public/cpp/bindings/binding.h"
34 #include "mojo/public/cpp/bindings/interface_request.h" 33 #include "mojo/public/cpp/bindings/interface_request.h"
35 #include "net/test/embedded_test_server/embedded_test_server.h" 34 #include "net/test/embedded_test_server/embedded_test_server.h"
35 #include "services/shell/public/cpp/interface_registry.h"
36 36
37 namespace content { 37 namespace content {
38 namespace { 38 namespace {
39 39
40 base::FilePath GetFilePathForJSResource(const std::string& path) { 40 base::FilePath GetFilePathForJSResource(const std::string& path) {
41 std::string binding_path = "gen/" + path + ".js"; 41 std::string binding_path = "gen/" + path + ".js";
42 #if defined(OS_WIN) 42 #if defined(OS_WIN)
43 base::ReplaceChars(binding_path, "//", "\\", &binding_path); 43 base::ReplaceChars(binding_path, "//", "\\", &binding_path);
44 #endif 44 #endif
45 base::FilePath exe_dir; 45 base::FilePath exe_dir;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // implementation at the right time. 123 // implementation at the right time.
124 class PingTestWebUIController : public TestWebUIController { 124 class PingTestWebUIController : public TestWebUIController {
125 public: 125 public:
126 PingTestWebUIController(WebUI* web_ui, base::RunLoop* run_loop) 126 PingTestWebUIController(WebUI* web_ui, base::RunLoop* run_loop)
127 : TestWebUIController(web_ui, run_loop) { 127 : TestWebUIController(web_ui, run_loop) {
128 } 128 }
129 ~PingTestWebUIController() override {} 129 ~PingTestWebUIController() override {}
130 130
131 // WebUIController overrides: 131 // WebUIController overrides:
132 void RenderViewCreated(RenderViewHost* render_view_host) override { 132 void RenderViewCreated(RenderViewHost* render_view_host) override {
133 render_view_host->GetMainFrame()->GetServiceRegistry()->AddService( 133 render_view_host->GetMainFrame()->GetInterfaceRegistry()->AddInterface(
134 base::Bind(&PingTestWebUIController::CreateHandler, 134 base::Bind(&PingTestWebUIController::CreateHandler,
135 base::Unretained(this))); 135 base::Unretained(this)));
136 } 136 }
137 137
138 void CreateHandler(mojo::InterfaceRequest<mojom::BrowserTarget> request) { 138 void CreateHandler(mojo::InterfaceRequest<mojom::BrowserTarget> request) {
139 browser_target_.reset(new BrowserTargetImpl(run_loop_, std::move(request))); 139 browser_target_.reset(new BrowserTargetImpl(run_loop_, std::move(request)));
140 } 140 }
141 141
142 private: 142 private:
143 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController); 143 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 NavigateToURL(other_shell, test_url); 231 NavigateToURL(other_shell, test_url);
232 // RunLoop is quit when message received from page. 232 // RunLoop is quit when message received from page.
233 other_run_loop.Run(); 233 other_run_loop.Run();
234 EXPECT_TRUE(got_message); 234 EXPECT_TRUE(got_message);
235 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), 235 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(),
236 other_shell->web_contents()->GetRenderProcessHost()); 236 other_shell->web_contents()->GetRenderProcessHost());
237 } 237 }
238 238
239 } // namespace 239 } // namespace
240 } // namespace content 240 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/vibration_browsertest.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698