Index: mojo/public/cpp/bindings/tests/request_response_unittest.cc |
diff --git a/mojo/public/cpp/bindings/tests/request_response_unittest.cc b/mojo/public/cpp/bindings/tests/request_response_unittest.cc |
index 94ed91ff875fe150b2add318070bcb8d73d61a18..25057a4fc2e0e2bdbb1192f936be025e7f365484 100644 |
--- a/mojo/public/cpp/bindings/tests/request_response_unittest.cc |
+++ b/mojo/public/cpp/bindings/tests/request_response_unittest.cc |
@@ -3,7 +3,7 @@ |
// found in the LICENSE file. |
#include "mojo/public/cpp/bindings/allocation_scope.h" |
-#include "mojo/public/cpp/bindings/remote_ptr.h" |
+#include "mojo/public/cpp/bindings/tests/test_bindings_utils.h" |
#include "mojo/public/cpp/environment/environment.h" |
#include "mojo/public/cpp/test_support/test_utils.h" |
#include "mojo/public/cpp/utility/run_loop.h" |
@@ -17,8 +17,8 @@ namespace { |
class ProviderImpl : public sample::Provider { |
public: |
- explicit ProviderImpl(sample::ScopedProviderClientHandle handle) |
- : client_(handle.Pass(), this) { |
+ virtual void SetClient(sample::ProviderClient* client) MOJO_OVERRIDE { |
+ // Ignored. TODO(darin): Eliminate ProviderClient. |
} |
virtual void EchoString( |
@@ -51,9 +51,6 @@ class ProviderImpl : public sample::Provider { |
MOJO_OVERRIDE { |
callback.Run(a); |
} |
- |
- private: |
- RemotePtr<sample::ProviderClient> client_; |
}; |
class StringRecorder { |
@@ -94,6 +91,11 @@ class MessagePipeWriter { |
class RequestResponseTest : public testing::Test { |
public: |
+ virtual void TearDown() { |
+ PumpMessages(); |
+ EXPECT_EQ(0, internal::GetDetachedStateCount()); |
+ } |
+ |
void PumpMessages() { |
loop_.RunUntilIdle(); |
} |
@@ -104,9 +106,8 @@ class RequestResponseTest : public testing::Test { |
}; |
TEST_F(RequestResponseTest, EchoString) { |
- InterfacePipe<sample::Provider> pipe; |
- ProviderImpl provider_impl(pipe.handle_to_peer.Pass()); |
- RemotePtr<sample::Provider> provider(pipe.handle_to_self.Pass(), NULL); |
+ sample::ProviderPtr provider; |
+ MakeRemote(new ProviderImpl(), &provider); |
std::string buf; |
{ |
@@ -120,9 +121,8 @@ TEST_F(RequestResponseTest, EchoString) { |
} |
TEST_F(RequestResponseTest, EchoStrings) { |
- InterfacePipe<sample::Provider> pipe; |
- ProviderImpl provider_impl(pipe.handle_to_peer.Pass()); |
- RemotePtr<sample::Provider> provider(pipe.handle_to_self.Pass(), NULL); |
+ sample::ProviderPtr provider; |
+ MakeRemote(new ProviderImpl(), &provider); |
std::string buf; |
{ |
@@ -136,9 +136,8 @@ TEST_F(RequestResponseTest, EchoStrings) { |
} |
TEST_F(RequestResponseTest, EchoMessagePipeHandle) { |
- InterfacePipe<sample::Provider> pipe; |
- ProviderImpl provider_impl(pipe.handle_to_peer.Pass()); |
- RemotePtr<sample::Provider> provider(pipe.handle_to_self.Pass(), NULL); |
+ sample::ProviderPtr provider; |
+ MakeRemote(new ProviderImpl(), &provider); |
MessagePipe pipe2; |
{ |
@@ -156,9 +155,8 @@ TEST_F(RequestResponseTest, EchoMessagePipeHandle) { |
} |
TEST_F(RequestResponseTest, EchoEnum) { |
- InterfacePipe<sample::Provider> pipe; |
- ProviderImpl provider_impl(pipe.handle_to_peer.Pass()); |
- RemotePtr<sample::Provider> provider(pipe.handle_to_self.Pass(), NULL); |
+ sample::ProviderPtr provider; |
+ MakeRemote(new ProviderImpl(), &provider); |
sample::Enum value; |
{ |