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 "shell/application_manager/application_manager.h" | 5 #include "shell/application_manager/application_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 : context_(context), requestor_url_(requestor_url) {} | 307 : context_(context), requestor_url_(requestor_url) {} |
308 ~Tester() override {} | 308 ~Tester() override {} |
309 | 309 |
310 private: | 310 private: |
311 void Load(const GURL& url, | 311 void Load(const GURL& url, |
312 InterfaceRequest<Application> application_request) override { | 312 InterfaceRequest<Application> application_request) override { |
313 app_.reset(new ApplicationImpl(this, application_request.Pass())); | 313 app_.reset(new ApplicationImpl(this, application_request.Pass())); |
314 } | 314 } |
315 | 315 |
316 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { | 316 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { |
317 if (!requestor_url_.empty() && | 317 const std::string& remote_url = |
318 requestor_url_ != connection->GetRemoteApplicationURL()) { | 318 connection->GetServiceProviderImpl().connection_context().remote_url; |
| 319 if (!requestor_url_.empty() && requestor_url_ != remote_url) { |
319 context_->set_tester_called_quit(); | 320 context_->set_tester_called_quit(); |
320 context_->QuitSoon(); | 321 context_->QuitSoon(); |
321 base::MessageLoop::current()->Quit(); | 322 base::MessageLoop::current()->Quit(); |
322 return false; | 323 return false; |
323 } | 324 } |
324 // If we're coming from A, then add B, otherwise A. | 325 // If we're coming from A, then add B, otherwise A. |
325 if (connection->GetRemoteApplicationURL() == kTestAURLString) | 326 if (remote_url == kTestAURLString) |
326 connection->AddService<TestB>(this); | 327 connection->AddService<TestB>(this); |
327 else | 328 else |
328 connection->AddService<TestA>(this); | 329 connection->AddService<TestA>(this); |
329 return true; | 330 return true; |
330 } | 331 } |
331 | 332 |
332 void Create(const ConnectionContext& connection_context, | 333 void Create(const ConnectionContext& connection_context, |
333 InterfaceRequest<TestA> request) override { | 334 InterfaceRequest<TestA> request) override { |
334 mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle; | 335 mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle; |
335 app_->shell()->ConnectToApplication(kTestBURLString, | 336 app_->shell()->ConnectToApplication(kTestBURLString, |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 bool called = false; | 790 bool called = false; |
790 application_manager_->ConnectToApplication( | 791 application_manager_->ConnectToApplication( |
791 GURL("test:test"), GURL(), nullptr, | 792 GURL("test:test"), GURL(), nullptr, |
792 base::Bind(&QuitClosure, base::Unretained(&called))); | 793 base::Bind(&QuitClosure, base::Unretained(&called))); |
793 loop_.Run(); | 794 loop_.Run(); |
794 EXPECT_TRUE(called); | 795 EXPECT_TRUE(called); |
795 } | 796 } |
796 | 797 |
797 } // namespace | 798 } // namespace |
798 } // namespace shell | 799 } // namespace shell |
OLD | NEW |