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

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

Issue 99623010: Add support for enums within structs and interfaces to mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 if (i % 2 == 1) 203 if (i % 2 == 1)
204 printf(" "); 204 printf(" ");
205 if (i % 8 == 7) 205 if (i % 8 == 7)
206 printf(" "); 206 printf(" ");
207 } 207 }
208 } 208 }
209 209
210 class ServiceImpl : public ServiceStub { 210 class ServiceImpl : public ServiceStub {
211 public: 211 public:
212 virtual void Frobinate(const Foo& foo, bool baz, 212 virtual void Frobinate(const Foo& foo, int32_t baz,
DaveMoore 2013/12/20 02:53:18 Nit: I think there was a reason that we decided no
213 mojo::ScopedMessagePipeHandle port) 213 mojo::ScopedMessagePipeHandle port)
214 MOJO_OVERRIDE { 214 MOJO_OVERRIDE {
215 // Users code goes here to handle the incoming Frobinate message. 215 // Users code goes here to handle the incoming Frobinate message.
216 216
217 // We mainly check that we're given the expected arguments. 217 // We mainly check that we're given the expected arguments.
218 CheckFoo(foo); 218 CheckFoo(foo);
219 EXPECT_TRUE(baz); 219 EXPECT_EQ(BAZ_EXTRA, baz);
220 220
221 // Also dump the Foo structure and all of its members. 221 // Also dump the Foo structure and all of its members.
222 // TODO(vtl): Make it optional, so that the test spews less? 222 // TODO(vtl): Make it optional, so that the test spews less?
223 printf("Frobinate:\n"); 223 printf("Frobinate:\n");
224 int depth = 1; 224 int depth = 1;
225 Print(depth, "foo", foo); 225 Print(depth, "foo", foo);
226 Print(depth, "baz", baz); 226 Print(depth, "baz", baz);
227 Print(depth, "port", port.get()); 227 Print(depth, "port", port.get());
228 } 228 }
229 }; 229 };
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // allocated. 261 // allocated.
262 262
263 mojo::AllocationScope scope; 263 mojo::AllocationScope scope;
264 264
265 Foo foo = MakeFoo(); 265 Foo foo = MakeFoo();
266 CheckFoo(foo); 266 CheckFoo(foo);
267 267
268 mojo::ScopedMessagePipeHandle port0, port1; 268 mojo::ScopedMessagePipeHandle port0, port1;
269 mojo::CreateMessagePipe(&port0, &port1); 269 mojo::CreateMessagePipe(&port0, &port1);
270 270
271 service->Frobinate(foo, true, port0.Pass()); 271 service->Frobinate(foo, Service::BAZ_EXTRA, port0.Pass());
272 } 272 }
273 273
274 } // namespace sample 274 } // namespace sample
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698