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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 std::string text2; | 60 std::string text2; |
61 if (request->pipe.is_valid()) { | 61 if (request->pipe.is_valid()) { |
62 EXPECT_TRUE(ReadTextMessage(request->pipe.get(), &text2)); | 62 EXPECT_TRUE(ReadTextMessage(request->pipe.get(), &text2)); |
63 | 63 |
64 // Ensure that simply accessing request->pipe does not close it. | 64 // Ensure that simply accessing request->pipe does not close it. |
65 EXPECT_TRUE(request->pipe.is_valid()); | 65 EXPECT_TRUE(request->pipe.is_valid()); |
66 } | 66 } |
67 | 67 |
68 ScopedMessagePipeHandle pipe0; | 68 ScopedMessagePipeHandle pipe0; |
69 if (!text2.empty()) { | 69 if (!text2.empty()) { |
70 CreateMessagePipe(&pipe0, &pipe1_); | 70 CreateMessagePipe(NULL, &pipe0, &pipe1_); |
71 EXPECT_TRUE(WriteTextMessage(pipe1_.get(), text2)); | 71 EXPECT_TRUE(WriteTextMessage(pipe1_.get(), text2)); |
72 } | 72 } |
73 | 73 |
74 sample::ResponsePtr response(sample::Response::New()); | 74 sample::ResponsePtr response(sample::Response::New()); |
75 response->x = 2; | 75 response->x = 2; |
76 response->pipe = pipe0.Pass(); | 76 response->pipe = pipe0.Pass(); |
77 client()->DidStuff(response.Pass(), text1); | 77 client()->DidStuff(response.Pass(), text1); |
78 } | 78 } |
79 | 79 |
80 virtual void DoStuff2(ScopedDataPipeConsumerHandle pipe) MOJO_OVERRIDE { | 80 virtual void DoStuff2(ScopedDataPipeConsumerHandle pipe) MOJO_OVERRIDE { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 PumpMessages(); // Yield for results. | 319 PumpMessages(); // Yield for results. |
320 | 320 |
321 EXPECT_EQ(std::string("object1"), name1); | 321 EXPECT_EQ(std::string("object1"), name1); |
322 EXPECT_EQ(std::string("object2"), name2); | 322 EXPECT_EQ(std::string("object2"), name2); |
323 } | 323 } |
324 | 324 |
325 } // namespace | 325 } // namespace |
326 } // namespace test | 326 } // namespace test |
327 } // namespace mojo | 327 } // namespace mojo |
OLD | NEW |