Index: shell/application_manager/application_manager_unittest.cc |
diff --git a/shell/application_manager/application_manager_unittest.cc b/shell/application_manager/application_manager_unittest.cc |
index bbf84bb4ce2ba01517a32f189fbe7123febaa9c1..de9fa1489194a7e13aebfedcbf50f2e9161be3b5 100644 |
--- a/shell/application_manager/application_manager_unittest.cc |
+++ b/shell/application_manager/application_manager_unittest.cc |
@@ -2,6 +2,10 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "shell/application_manager/application_manager.h" |
+ |
+#include <utility> |
+ |
#include "base/at_exit.h" |
#include "base/bind.h" |
#include "base/macros.h" |
@@ -10,11 +14,12 @@ |
#include "mojo/public/cpp/application/application_connection.h" |
#include "mojo/public/cpp/application/application_delegate.h" |
#include "mojo/public/cpp/application/application_impl.h" |
+#include "mojo/public/cpp/application/connect.h" |
#include "mojo/public/cpp/application/interface_factory.h" |
+#include "mojo/public/cpp/application/service_provider_impl.h" |
#include "mojo/public/cpp/bindings/strong_binding.h" |
#include "mojo/public/interfaces/application/service_provider.mojom.h" |
#include "shell/application_manager/application_loader.h" |
-#include "shell/application_manager/application_manager.h" |
#include "shell/application_manager/test.mojom.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -241,11 +246,12 @@ class TesterContext { |
// Used to test that the requestor url will be correctly passed. |
class TestAImpl : public TestA { |
public: |
- TestAImpl(ApplicationConnection* b_connection, |
+ TestAImpl(mojo::InterfaceHandle<mojo::ServiceProvider> b_sp_handle, |
TesterContext* test_context, |
InterfaceRequest<TestA> request) |
: test_context_(test_context), binding_(this, request.Pass()) { |
- b_connection->ConnectToService(&b_); |
+ auto b_sp = mojo::ServiceProviderPtr::Create(b_sp_handle.Pass()); |
+ mojo::ConnectToService(b_sp.get(), GetProxy(&b_)); |
} |
~TestAImpl() override { |
@@ -359,11 +365,19 @@ class Tester : public ApplicationDelegate, |
void Create(ApplicationConnection* connection, |
InterfaceRequest<TestA> request) override { |
- ApplicationConnection* b_connection = |
- app_->ConnectToApplicationDeprecated(kTestBURLString); |
- b_connection->AddService<TestC>(this); |
+ mojo::InterfaceHandle<mojo::ServiceProvider> incoming_sp_handle; |
+ mojo::InterfaceHandle<mojo::ServiceProvider> outgoing_sp_handle; |
+ mojo::InterfaceRequest<mojo::ServiceProvider> outgoing_sp_request = |
+ GetProxy(&outgoing_sp_handle); |
+ app_->shell()->ConnectToApplication(kTestBURLString, |
+ GetProxy(&incoming_sp_handle), |
+ outgoing_sp_handle.Pass()); |
+ std::unique_ptr<mojo::ServiceProviderImpl> outgoing_sp_impl( |
+ new mojo::ServiceProviderImpl(outgoing_sp_request.Pass())); |
+ outgoing_sp_impl->AddService<TestC>(this); |
+ outgoing_sp_impls_for_b_.push_back(std::move(outgoing_sp_impl)); |
a_bindings_.push_back( |
- new TestAImpl(b_connection, context_, request.Pass())); |
+ new TestAImpl(incoming_sp_handle.Pass(), context_, request.Pass())); |
} |
void Create(ApplicationConnection* connection, |
@@ -379,6 +393,8 @@ class Tester : public ApplicationDelegate, |
TesterContext* context_; |
scoped_ptr<ApplicationImpl> app_; |
std::string requestor_url_; |
+ std::vector<std::unique_ptr<mojo::ServiceProviderImpl>> |
+ outgoing_sp_impls_for_b_; |
ScopedVector<TestAImpl> a_bindings_; |
}; |