| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <ostream> | 6 #include <ostream> |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "mojo/public/tests/simple_bindings_support.h" | 9 #include "mojo/public/tests/simple_bindings_support.h" |
| 10 #include "mojom/sample_service.h" | 10 #include "mojom/sample_service.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 if (i % 2 == 1) | 234 if (i % 2 == 1) |
| 235 std::cout << " "; | 235 std::cout << " "; |
| 236 if (i % 8 == 7) | 236 if (i % 8 == 7) |
| 237 std::cout << " "; | 237 std::cout << " "; |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 class ServiceImpl : public ServiceStub { | 241 class ServiceImpl : public ServiceStub { |
| 242 public: | 242 public: |
| 243 virtual void Frobinate(const Foo& foo, bool baz, | 243 virtual void Frobinate(const Foo& foo, int32_t baz, |
| 244 mojo::ScopedMessagePipeHandle port) | 244 mojo::ScopedMessagePipeHandle port) |
| 245 MOJO_OVERRIDE { | 245 MOJO_OVERRIDE { |
| 246 // Users code goes here to handle the incoming Frobinate message. | 246 // Users code goes here to handle the incoming Frobinate message. |
| 247 | 247 |
| 248 // We mainly check that we're given the expected arguments. | 248 // We mainly check that we're given the expected arguments. |
| 249 CheckFoo(foo); | 249 CheckFoo(foo); |
| 250 EXPECT_TRUE(baz); | 250 EXPECT_EQ(BAZ_EXTRA, baz); |
| 251 | 251 |
| 252 // Also dump the Foo structure and all of its members. | 252 // Also dump the Foo structure and all of its members. |
| 253 // TODO(vtl): Make it optional, so that the test spews less? | 253 // TODO(vtl): Make it optional, so that the test spews less? |
| 254 std::cout << "Frobinate:" << std::endl; | 254 std::cout << "Frobinate:" << std::endl; |
| 255 int depth = 1; | 255 int depth = 1; |
| 256 Print(depth, "foo", foo); | 256 Print(depth, "foo", foo); |
| 257 Print(depth, "baz", baz); | 257 Print(depth, "baz", baz); |
| 258 Print(depth, "port", port.get()); | 258 Print(depth, "port", port.get()); |
| 259 } | 259 } |
| 260 }; | 260 }; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // allocated. | 292 // allocated. |
| 293 | 293 |
| 294 mojo::AllocationScope scope; | 294 mojo::AllocationScope scope; |
| 295 | 295 |
| 296 Foo foo = MakeFoo(); | 296 Foo foo = MakeFoo(); |
| 297 CheckFoo(foo); | 297 CheckFoo(foo); |
| 298 | 298 |
| 299 mojo::ScopedMessagePipeHandle port0, port1; | 299 mojo::ScopedMessagePipeHandle port0, port1; |
| 300 mojo::CreateMessagePipe(&port0, &port1); | 300 mojo::CreateMessagePipe(&port0, &port1); |
| 301 | 301 |
| 302 service->Frobinate(foo, true, port0.Pass()); | 302 service->Frobinate(foo, Service::BAZ_EXTRA, port0.Pass()); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace sample | 305 } // namespace sample |
| OLD | NEW |