| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/public/cpp/application/service_provider_impl.h" | 5 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "mojo/public/cpp/application/connect.h" | 9 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "mojo/public/cpp/environment/environment.h" | |
| 12 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 13 #include "mojo/public/cpp/utility/run_loop.h" | 12 #include "mojo/public/cpp/utility/run_loop.h" |
| 14 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 13 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
| 15 #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" | 14 #include "mojo/public/interfaces/bindings/tests/ping_service.mojom.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 namespace mojo { | 17 namespace mojo { |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 class ServiceProviderImplTest : public testing::Test { | 20 class ServiceProviderImplTest : public testing::Test { |
| 22 public: | 21 public: |
| 23 ServiceProviderImplTest() {} | 22 ServiceProviderImplTest() {} |
| 24 ~ServiceProviderImplTest() override { loop_.RunUntilIdle(); } | 23 ~ServiceProviderImplTest() override { loop_.RunUntilIdle(); } |
| 25 | 24 |
| 26 RunLoop& loop() { return loop_; } | 25 RunLoop& loop() { return loop_; } |
| 27 | 26 |
| 28 protected: | 27 protected: |
| 29 void QuitLoop(bool ok) { | 28 void QuitLoop(bool ok) { |
| 30 EXPECT_TRUE(ok); | 29 EXPECT_TRUE(ok); |
| 31 loop_.Quit(); | 30 loop_.Quit(); |
| 32 } | 31 } |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 Environment env_; | |
| 36 RunLoop loop_; | 34 RunLoop loop_; |
| 37 | 35 |
| 38 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceProviderImplTest); | 36 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceProviderImplTest); |
| 39 }; | 37 }; |
| 40 | 38 |
| 41 class PingServiceImpl : public test::PingService { | 39 class PingServiceImpl : public test::PingService { |
| 42 public: | 40 public: |
| 43 PingServiceImpl(InterfaceRequest<test::PingService> ping_service_request) | 41 PingServiceImpl(InterfaceRequest<test::PingService> ping_service_request) |
| 44 : strong_binding_(this, std::move(ping_service_request)) {} | 42 : strong_binding_(this, std::move(ping_service_request)) {} |
| 45 ~PingServiceImpl() override {} | 43 ~PingServiceImpl() override {} |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 InterfaceRequest<ServiceProvider>()); | 343 InterfaceRequest<ServiceProvider>()); |
| 346 EXPECT_EQ(ConnectionContext::Type::UNKNOWN, impl.connection_context().type); | 344 EXPECT_EQ(ConnectionContext::Type::UNKNOWN, impl.connection_context().type); |
| 347 EXPECT_EQ(std::string(), impl.connection_context().remote_url); | 345 EXPECT_EQ(std::string(), impl.connection_context().remote_url); |
| 348 EXPECT_EQ(std::string(), impl.connection_context().connection_url); | 346 EXPECT_EQ(std::string(), impl.connection_context().connection_url); |
| 349 } | 347 } |
| 350 | 348 |
| 351 // TODO(vtl): Explicitly test |AddServiceForName()|? | 349 // TODO(vtl): Explicitly test |AddServiceForName()|? |
| 352 | 350 |
| 353 } // namespace | 351 } // namespace |
| 354 } // namespace mojo | 352 } // namespace mojo |
| OLD | NEW |