Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Unified Diff: mojo/public/cpp/bindings/tests/request_response_unittest.cc

Issue 265793015: Mojo: Replace RemotePtr with InterfacePtr and InterfaceImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d163f7d4b4fb283d0247edab7a126259eacf3e43 100644
--- a/mojo/public/cpp/bindings/tests/request_response_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/request_response_unittest.cc
@@ -3,7 +3,6 @@
// 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/environment/environment.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "mojo/public/cpp/utility/run_loop.h"
@@ -15,10 +14,14 @@ namespace mojo {
namespace test {
namespace {
-class ProviderImpl : public sample::Provider {
+class ProviderImpl : public InterfaceImpl<sample::Provider> {
public:
- explicit ProviderImpl(sample::ScopedProviderClientHandle handle)
- : client_(handle.Pass(), this) {
+ virtual void OnConnectionError() MOJO_OVERRIDE {
+ delete this;
+ }
+
+ virtual void SetClient(sample::ProviderClient* client) MOJO_OVERRIDE {
+ // Ignored. TODO(darin): Eliminate ProviderClient.
}
virtual void EchoString(
@@ -51,9 +54,6 @@ class ProviderImpl : public sample::Provider {
MOJO_OVERRIDE {
callback.Run(a);
}
-
- private:
- RemotePtr<sample::ProviderClient> client_;
};
class StringRecorder {
@@ -94,6 +94,10 @@ class MessagePipeWriter {
class RequestResponseTest : public testing::Test {
public:
+ virtual ~RequestResponseTest() {
+ loop_.RunUntilIdle();
+ }
+
void PumpMessages() {
loop_.RunUntilIdle();
}
@@ -104,9 +108,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;
+ BindToProxy(new ProviderImpl(), &provider);
std::string buf;
{
@@ -120,9 +123,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;
+ BindToProxy(new ProviderImpl(), &provider);
std::string buf;
{
@@ -136,9 +138,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;
+ BindToProxy(new ProviderImpl(), &provider);
MessagePipe pipe2;
{
@@ -156,9 +157,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;
+ BindToProxy(new ProviderImpl(), &provider);
sample::Enum value;
{

Powered by Google App Engine
This is Rietveld 408576698