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

Side by Side Diff: mojo/public/cpp/bindings/tests/sample_service_unittest.cc

Issue 617503003: Mojo: MOJO_OVERRIDE -> override in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/cpp/environment/environment.h" 9 #include "mojo/public/cpp/environment/environment.h"
10 #include "mojo/public/cpp/system/macros.h" 10 #include "mojo/public/cpp/system/macros.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 if (i % 2 == 1) 249 if (i % 2 == 1)
250 std::cout << " "; 250 std::cout << " ";
251 if (i % 8 == 7) 251 if (i % 8 == 7)
252 std::cout << " "; 252 std::cout << " ";
253 } 253 }
254 } 254 }
255 255
256 class ServiceImpl : public Service { 256 class ServiceImpl : public Service {
257 public: 257 public:
258 virtual void Frobinate(FooPtr foo, BazOptions baz, PortPtr port) 258 virtual void Frobinate(FooPtr foo, BazOptions baz, PortPtr port) override {
259 MOJO_OVERRIDE {
260 // Users code goes here to handle the incoming Frobinate message. 259 // Users code goes here to handle the incoming Frobinate message.
261 260
262 // We mainly check that we're given the expected arguments. 261 // We mainly check that we're given the expected arguments.
263 EXPECT_FALSE(foo.is_null()); 262 EXPECT_FALSE(foo.is_null());
264 if (!foo.is_null()) 263 if (!foo.is_null())
265 CheckFoo(*foo); 264 CheckFoo(*foo);
266 EXPECT_EQ(BAZ_OPTIONS_EXTRA, baz); 265 EXPECT_EQ(BAZ_OPTIONS_EXTRA, baz);
267 266
268 if (g_dump_message_as_text) { 267 if (g_dump_message_as_text) {
269 // Also dump the Foo structure and all of its members. 268 // Also dump the Foo structure and all of its members.
270 std::cout << "Frobinate:" << std::endl; 269 std::cout << "Frobinate:" << std::endl;
271 int depth = 1; 270 int depth = 1;
272 Print(depth, "foo", foo); 271 Print(depth, "foo", foo);
273 Print(depth, "baz", baz); 272 Print(depth, "baz", baz);
274 Print(depth, "port", port.get()); 273 Print(depth, "port", port.get());
275 } 274 }
276 } 275 }
277 276
278 virtual void GetPort(mojo::InterfaceRequest<Port> port_request) 277 virtual void GetPort(mojo::InterfaceRequest<Port> port_request) override {}
279 MOJO_OVERRIDE {
280 }
281 }; 278 };
282 279
283 class ServiceProxyImpl : public ServiceProxy { 280 class ServiceProxyImpl : public ServiceProxy {
284 public: 281 public:
285 explicit ServiceProxyImpl(mojo::MessageReceiverWithResponder* receiver) 282 explicit ServiceProxyImpl(mojo::MessageReceiverWithResponder* receiver)
286 : ServiceProxy(receiver) { 283 : ServiceProxy(receiver) {
287 } 284 }
288 }; 285 };
289 286
290 class SimpleMessageReceiver : public mojo::MessageReceiverWithResponder { 287 class SimpleMessageReceiver : public mojo::MessageReceiverWithResponder {
291 public: 288 public:
292 virtual bool Accept(mojo::Message* message) MOJO_OVERRIDE { 289 virtual bool Accept(mojo::Message* message) override {
293 // Imagine some IPC happened here. 290 // Imagine some IPC happened here.
294 291
295 if (g_dump_message_as_hex) { 292 if (g_dump_message_as_hex) {
296 DumpHex(reinterpret_cast<const uint8_t*>(message->data()), 293 DumpHex(reinterpret_cast<const uint8_t*>(message->data()),
297 message->data_num_bytes()); 294 message->data_num_bytes());
298 } 295 }
299 296
300 // In the receiving process, an implementation of ServiceStub is known to 297 // In the receiving process, an implementation of ServiceStub is known to
301 // the system. It receives the incoming message. 298 // the system. It receives the incoming message.
302 ServiceImpl impl; 299 ServiceImpl impl;
303 300
304 ServiceStub stub; 301 ServiceStub stub;
305 stub.set_sink(&impl); 302 stub.set_sink(&impl);
306 return stub.Accept(message); 303 return stub.Accept(message);
307 } 304 }
308 305
309 virtual bool AcceptWithResponder(mojo::Message* message, 306 virtual bool AcceptWithResponder(mojo::Message* message,
310 mojo::MessageReceiver* responder) 307 mojo::MessageReceiver* responder) override {
311 MOJO_OVERRIDE {
312 return false; 308 return false;
313 } 309 }
314 }; 310 };
315 311
316 class BindingsSampleTest : public testing::Test { 312 class BindingsSampleTest : public testing::Test {
317 public: 313 public:
318 BindingsSampleTest() {} 314 BindingsSampleTest() {}
319 virtual ~BindingsSampleTest() {} 315 virtual ~BindingsSampleTest() {}
320 316
321 private: 317 private:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 ASSERT_FALSE(defaults->a22.is_null()); 368 ASSERT_FALSE(defaults->a22.is_null());
373 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape); 369 EXPECT_EQ(imported::SHAPE_RECTANGLE, defaults->a22->shape);
374 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color); 370 EXPECT_EQ(imported::COLOR_BLACK, defaults->a22->color);
375 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, defaults->a23); 371 EXPECT_EQ(0xFFFFFFFFFFFFFFFFULL, defaults->a23);
376 EXPECT_EQ(0x123456789, defaults->a24); 372 EXPECT_EQ(0x123456789, defaults->a24);
377 EXPECT_EQ(-0x123456789, defaults->a25); 373 EXPECT_EQ(-0x123456789, defaults->a25);
378 } 374 }
379 375
380 } // namespace 376 } // namespace
381 } // namespace sample 377 } // namespace sample
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/router_unittest.cc ('k') | mojo/public/cpp/bindings/tests/validation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698