| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/environment/environment.h" | 5 #include "mojo/public/cpp/environment/environment.h" |
| 6 #include "mojo/public/cpp/test_support/test_utils.h" | 6 #include "mojo/public/cpp/test_support/test_utils.h" |
| 7 #include "mojo/public/cpp/utility/run_loop.h" | 7 #include "mojo/public/cpp/utility/run_loop.h" |
| 8 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" | 8 #include "mojo/public/interfaces/bindings/tests/sample_factory.mojom.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 client()->DidStuff2(data); | 95 client()->DidStuff2(data); |
| 96 } | 96 } |
| 97 | 97 |
| 98 virtual void CreateObject(InterfaceRequest<sample::Object> object_request) | 98 virtual void CreateObject(InterfaceRequest<sample::Object> object_request) |
| 99 MOJO_OVERRIDE { | 99 MOJO_OVERRIDE { |
| 100 EXPECT_TRUE(object_request.is_pending()); | 100 EXPECT_TRUE(object_request.is_pending()); |
| 101 BindToRequest(new SampleObjectImpl(), &object_request); | 101 BindToRequest(new SampleObjectImpl(), &object_request); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // These aren't called or implemented, but exist here to test that the |
| 105 // methods are generated with the correct argument types for imported |
| 106 // interfaces. |
| 107 virtual void RequestImportedInterface( |
| 108 InterfaceRequest<imported::ImportedInterface> imported, |
| 109 const mojo::Callback<void(InterfaceRequest<imported::ImportedInterface>)>& |
| 110 callback) MOJO_OVERRIDE {} |
| 111 virtual void TakeImportedInterface( |
| 112 imported::ImportedInterfacePtr imported, |
| 113 const mojo::Callback<void(imported::ImportedInterfacePtr)>& callback) |
| 114 MOJO_OVERRIDE {} |
| 115 |
| 104 private: | 116 private: |
| 105 ScopedMessagePipeHandle pipe1_; | 117 ScopedMessagePipeHandle pipe1_; |
| 106 }; | 118 }; |
| 107 | 119 |
| 108 class SampleFactoryClientImpl : public sample::FactoryClient { | 120 class SampleFactoryClientImpl : public sample::FactoryClient { |
| 109 public: | 121 public: |
| 110 SampleFactoryClientImpl() : got_response_(false) { | 122 SampleFactoryClientImpl() : got_response_(false) { |
| 111 } | 123 } |
| 112 | 124 |
| 113 void set_expected_text_reply(const std::string& expected_text_reply) { | 125 void set_expected_text_reply(const std::string& expected_text_reply) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 334 |
| 323 PumpMessages(); // Yield for results. | 335 PumpMessages(); // Yield for results. |
| 324 | 336 |
| 325 EXPECT_EQ(std::string("object1"), name1); | 337 EXPECT_EQ(std::string("object1"), name1); |
| 326 EXPECT_EQ(std::string("object2"), name2); | 338 EXPECT_EQ(std::string("object2"), name2); |
| 327 } | 339 } |
| 328 | 340 |
| 329 } // namespace | 341 } // namespace |
| 330 } // namespace test | 342 } // namespace test |
| 331 } // namespace mojo | 343 } // namespace mojo |
| OLD | NEW |