| Index: mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
|
| index 99eddf83410615547d2b3be19a7f8437fb4cf792..ab2e47506cc4d7192398be09df6da1bca38022e7 100644
|
| --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
|
| @@ -26,6 +26,24 @@ class StringRecorder {
|
| std::string* buf_;
|
| };
|
|
|
| +class ImportedInterfaceImpl
|
| + : public InterfaceImpl<imported::ImportedInterface> {
|
| + public:
|
| + virtual void OnConnectionError() MOJO_OVERRIDE {
|
| + delete this;
|
| + }
|
| +
|
| + virtual void DoSomething() MOJO_OVERRIDE {
|
| + do_something_count_++;
|
| + }
|
| +
|
| + static int do_something_count() { return do_something_count_; }
|
| +
|
| + private:
|
| + static int do_something_count_;
|
| +};
|
| +int ImportedInterfaceImpl::do_something_count_ = 0;
|
| +
|
| class SampleNamedObjectImpl : public InterfaceImpl<sample::NamedObject> {
|
| public:
|
| virtual void OnConnectionError() MOJO_OVERRIDE {
|
| @@ -75,6 +93,9 @@ class SampleFactoryImpl : public InterfaceImpl<sample::Factory> {
|
| response->x = 2;
|
| response->pipe = pipe0.Pass();
|
| client()->DidStuff(response.Pass(), text1);
|
| +
|
| + if (request->obj.get())
|
| + request->obj->DoSomething();
|
| }
|
|
|
| virtual void DoStuff2(ScopedDataPipeConsumerHandle pipe) MOJO_OVERRIDE {
|
| @@ -194,16 +215,22 @@ TEST_F(HandlePassingTest, Basic) {
|
| MessagePipe pipe1;
|
| EXPECT_TRUE(WriteTextMessage(pipe1.handle1.get(), kText2));
|
|
|
| + imported::ImportedInterfacePtr imported;
|
| + BindToProxy(new ImportedInterfaceImpl(), &imported);
|
| +
|
| sample::RequestPtr request(sample::Request::New());
|
| request->x = 1;
|
| request->pipe = pipe1.handle0.Pass();
|
| + request->obj = imported.Pass();
|
| factory->DoStuff(request.Pass(), pipe0.handle0.Pass());
|
|
|
| EXPECT_FALSE(factory_client.got_response());
|
| + int count_before = ImportedInterfaceImpl::do_something_count();
|
|
|
| PumpMessages();
|
|
|
| EXPECT_TRUE(factory_client.got_response());
|
| + EXPECT_EQ(1, ImportedInterfaceImpl::do_something_count() - count_before);
|
| }
|
|
|
| TEST_F(HandlePassingTest, PassInvalid) {
|
|
|