OLD | NEW |
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/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
27 #include "content/public/common/url_utils.h" | 27 #include "content/public/common/url_utils.h" |
28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
29 #include "content/public/test/content_browser_test.h" | 29 #include "content/public/test/content_browser_test.h" |
30 #include "content/public/test/content_browser_test_utils.h" | 30 #include "content/public/test/content_browser_test_utils.h" |
31 #include "content/shell/browser/shell.h" | 31 #include "content/shell/browser/shell.h" |
32 #include "content/test/data/web_ui_test_mojo_bindings.mojom.h" | 32 #include "content/test/data/web_ui_test_mojo_bindings.mojom.h" |
33 #include "mojo/public/cpp/bindings/binding.h" | 33 #include "mojo/public/cpp/bindings/binding.h" |
34 #include "mojo/public/cpp/bindings/interface_request.h" | 34 #include "mojo/public/cpp/bindings/interface_request.h" |
35 #include "net/test/embedded_test_server/embedded_test_server.h" | 35 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 36 #include "services/service_manager/public/cpp/bind_source_info.h" |
36 #include "services/service_manager/public/cpp/binder_registry.h" | 37 #include "services/service_manager/public/cpp/binder_registry.h" |
37 | 38 |
38 namespace content { | 39 namespace content { |
39 namespace { | 40 namespace { |
40 | 41 |
41 bool g_got_message = false; | 42 bool g_got_message = false; |
42 | 43 |
43 base::FilePath GetFilePathForJSResource(const std::string& path) { | 44 base::FilePath GetFilePathForJSResource(const std::string& path) { |
44 base::ThreadRestrictions::ScopedAllowIO allow_io_from_test_callbacks; | 45 base::ThreadRestrictions::ScopedAllowIO allow_io_from_test_callbacks; |
45 | 46 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 : TestWebUIController(web_ui, run_loop) {} | 128 : TestWebUIController(web_ui, run_loop) {} |
128 ~PingTestWebUIController() override {} | 129 ~PingTestWebUIController() override {} |
129 | 130 |
130 // WebUIController overrides: | 131 // WebUIController overrides: |
131 void RenderFrameCreated(RenderFrameHost* render_frame_host) override { | 132 void RenderFrameCreated(RenderFrameHost* render_frame_host) override { |
132 render_frame_host->GetInterfaceRegistry()->AddInterface( | 133 render_frame_host->GetInterfaceRegistry()->AddInterface( |
133 base::Bind(&PingTestWebUIController::CreateHandler, | 134 base::Bind(&PingTestWebUIController::CreateHandler, |
134 base::Unretained(this))); | 135 base::Unretained(this))); |
135 } | 136 } |
136 | 137 |
137 void CreateHandler(mojo::InterfaceRequest<mojom::BrowserTarget> request) { | 138 void CreateHandler(const service_manager::BindSourceInfo& source_info, |
| 139 mojom::BrowserTargetRequest request) { |
138 browser_target_ = | 140 browser_target_ = |
139 base::MakeUnique<BrowserTargetImpl>(run_loop_, std::move(request)); | 141 base::MakeUnique<BrowserTargetImpl>(run_loop_, std::move(request)); |
140 } | 142 } |
141 | 143 |
142 private: | 144 private: |
143 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController); | 145 DISALLOW_COPY_AND_ASSIGN(PingTestWebUIController); |
144 }; | 146 }; |
145 | 147 |
146 // WebUIControllerFactory that creates TestWebUIController. | 148 // WebUIControllerFactory that creates TestWebUIController. |
147 class TestWebUIControllerFactory : public WebUIControllerFactory { | 149 class TestWebUIControllerFactory : public WebUIControllerFactory { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 NavigateToURL(other_shell, test_url); | 234 NavigateToURL(other_shell, test_url); |
233 // RunLoop is quit when message received from page. | 235 // RunLoop is quit when message received from page. |
234 other_run_loop.Run(); | 236 other_run_loop.Run(); |
235 EXPECT_TRUE(g_got_message); | 237 EXPECT_TRUE(g_got_message); |
236 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), | 238 EXPECT_EQ(shell()->web_contents()->GetRenderProcessHost(), |
237 other_shell->web_contents()->GetRenderProcessHost()); | 239 other_shell->web_contents()->GetRenderProcessHost()); |
238 } | 240 } |
239 | 241 |
240 } // namespace | 242 } // namespace |
241 } // namespace content | 243 } // namespace content |
OLD | NEW |