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

Unified Diff: mojo/public/cpp/bindings/tests/sample_service_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/sample_service_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
index 9a4cf3633f365db55cc91a2a3256ffcaab326422..c13517dd810ebe81e48655a33eca772514686fbb 100644
--- a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc
@@ -266,7 +266,14 @@ void DumpHex(const uint8_t* bytes, uint32_t num_bytes) {
class ServiceImpl : public Service {
public:
- virtual void Frobinate(const Foo& foo, BazOptions baz, ScopedPortHandle port)
+ ServiceImpl() : client_(NULL) {
+ }
+
+ virtual void SetClient(ServiceClient* client) MOJO_OVERRIDE {
+ client_ = client;
+ }
+
+ virtual void Frobinate(const Foo& foo, BazOptions baz, PortPtr port)
MOJO_OVERRIDE {
// Users code goes here to handle the incoming Frobinate message.
@@ -283,6 +290,20 @@ class ServiceImpl : public Service {
Print(depth, "port", port.get());
}
}
+
+ private:
+ ServiceClient* client_;
+};
+
+class ServiceProxyImpl : public ServiceProxy {
+ public:
+ explicit ServiceProxyImpl(mojo::MessageReceiver* receiver)
+ : ServiceProxy(receiver) {
+ }
+
+ virtual void SetClient(ServiceClient* client) MOJO_OVERRIDE {
+ assert(false);
+ }
};
class SimpleMessageReceiver : public mojo::MessageReceiver {
@@ -299,7 +320,8 @@ class SimpleMessageReceiver : public mojo::MessageReceiver {
// the system. It receives the incoming message.
ServiceImpl impl;
- ServiceStub stub(&impl);
+ ServiceStub stub;
+ stub.set_sink(&impl);
return stub.Accept(message);
}
@@ -315,7 +337,7 @@ TEST(BindingsSampleTest, Basic) {
SimpleMessageReceiver receiver;
// User has a proxy to a Service somehow.
- Service* service = new ServiceProxy(&receiver);
+ Service* service = new ServiceProxyImpl(&receiver);
// User constructs a message to send.
@@ -328,8 +350,8 @@ TEST(BindingsSampleTest, Basic) {
Foo foo = MakeFoo();
CheckFoo(foo);
- mojo::InterfacePipe<Port, mojo::AnyInterface> pipe;
- service->Frobinate(foo, Service::BAZ_EXTRA, pipe.handle_to_self.Pass());
+ PortPtr port;
+ service->Frobinate(foo, Service::BAZ_EXTRA, port.Pass());
}
TEST(BindingsSampleTest, DefaultValues) {

Powered by Google App Engine
This is Rietveld 408576698