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

Side by Side Diff: mojo/public/tests/bindings/sample_service_unittests.cc

Issue 134253004: Mojo: AsyncWaiter and mojo/public/environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bindings/simple_bindings_support.h" 9 #include "mojo/public/environment/environment.h"
10 #include "mojom/sample_service.h" 10 #include "mojom/sample_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 template <> 15 template <>
16 class TypeConverter<sample::Bar, int32_t> { 16 class TypeConverter<sample::Bar, int32_t> {
17 public: 17 public:
18 static int32_t ConvertTo(const sample::Bar& bar) { 18 static int32_t ConvertTo(const sample::Bar& bar) {
19 return static_cast<int32_t>(bar.alpha()) << 16 | 19 return static_cast<int32_t>(bar.alpha()) << 16 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 ServiceImpl impl; 279 ServiceImpl impl;
280 280
281 ServiceStub stub(&impl); 281 ServiceStub stub(&impl);
282 return stub.Accept(message); 282 return stub.Accept(message);
283 } 283 }
284 }; 284 };
285 285
286 } // namespace 286 } // namespace
287 287
288 TEST(BindingsSampleTest, Basic) { 288 TEST(BindingsSampleTest, Basic) {
289 mojo::test::SimpleBindingsSupport bindings_support; 289 mojo::Environment env;
290 SimpleMessageReceiver receiver; 290 SimpleMessageReceiver receiver;
291 291
292 // User has a proxy to a Service somehow. 292 // User has a proxy to a Service somehow.
293 Service* service = new ServiceProxy(&receiver); 293 Service* service = new ServiceProxy(&receiver);
294 294
295 // User constructs a message to send. 295 // User constructs a message to send.
296 296
297 // Notice that it doesn't matter in what order the structs / arrays are 297 // Notice that it doesn't matter in what order the structs / arrays are
298 // allocated. Here, the various members of Foo are allocated before Foo is 298 // allocated. Here, the various members of Foo are allocated before Foo is
299 // allocated. 299 // allocated.
300 300
301 mojo::AllocationScope scope; 301 mojo::AllocationScope scope;
302 302
303 Foo foo = MakeFoo(); 303 Foo foo = MakeFoo();
304 CheckFoo(foo); 304 CheckFoo(foo);
305 305
306 mojo::ScopedMessagePipeHandle port0, port1; 306 mojo::ScopedMessagePipeHandle port0, port1;
307 mojo::CreateMessagePipe(&port0, &port1); 307 mojo::CreateMessagePipe(&port0, &port1);
308 308
309 service->Frobinate(foo, Service::BAZ_EXTRA, port0.Pass()); 309 service->Frobinate(foo, Service::BAZ_EXTRA, port0.Pass());
310 } 310 }
311 311
312 } // namespace sample 312 } // namespace sample
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698