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

Side by Side Diff: mojo/public/cpp/system/tests/core_unittest.cc

Issue 1552983003: Fix a bunch of mojo_public_*_unittests with the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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
« no previous file with comments | « mojo/public/cpp/environment/logging.h ('k') | mojo/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file tests the C++ Mojo system core wrappers. 5 // This file tests the C++ Mojo system core wrappers.
6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets 6 // TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets
7 // compiled into a different binary from the C API tests. 7 // compiled into a different binary from the C API tests.
8 8
9 #include "mojo/public/cpp/system/core.h" 9 #include "mojo/public/cpp/system/core.h"
10 10
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // Tear down a message pipe which still has a message enqueued, with the 359 // Tear down a message pipe which still has a message enqueued, with the
360 // message also having a valid message pipe handle. 360 // message also having a valid message pipe handle.
361 { 361 {
362 ScopedMessagePipeHandle h0; 362 ScopedMessagePipeHandle h0;
363 ScopedMessagePipeHandle h1; 363 ScopedMessagePipeHandle h1;
364 CreateMessagePipe(nullptr, &h0, &h1); 364 CreateMessagePipe(nullptr, &h0, &h1);
365 365
366 // Send a handle over the previously-establish message pipe. 366 // Send a handle over the previously-establish message pipe.
367 ScopedMessagePipeHandle h2; 367 ScopedMessagePipeHandle h2;
368 ScopedMessagePipeHandle h3; 368 ScopedMessagePipeHandle h3;
369 CreateMessagePipe(nullptr, &h2, &h3); 369 MojoCreateMessagePipeOptions options;
370 options.struct_size = sizeof(MojoCreateMessagePipeOptions);
371 options.flags = MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE;
372 if (CreateMessagePipe(&options, &h2, &h3) != MOJO_RESULT_OK)
373 CreateMessagePipe(nullptr, &h2, &h3); // Must be old EDK.
370 374
371 // Write a message to |h2|, before we send |h3|. 375 // Write a message to |h2|, before we send |h3|.
372 const char kWorld[] = "world!"; 376 const char kWorld[] = "world!";
373 const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld)); 377 const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld));
374 EXPECT_EQ(MOJO_RESULT_OK, 378 EXPECT_EQ(MOJO_RESULT_OK,
375 WriteMessageRaw(h2.get(), 379 WriteMessageRaw(h2.get(),
376 kWorld, 380 kWorld,
377 kWorldSize, 381 kWorldSize,
378 nullptr, 382 nullptr,
379 0, 383 0,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Do this in a different order: make the enqueued message pipe handle only 416 // Do this in a different order: make the enqueued message pipe handle only
413 // half-alive. 417 // half-alive.
414 { 418 {
415 ScopedMessagePipeHandle h0; 419 ScopedMessagePipeHandle h0;
416 ScopedMessagePipeHandle h1; 420 ScopedMessagePipeHandle h1;
417 CreateMessagePipe(nullptr, &h0, &h1); 421 CreateMessagePipe(nullptr, &h0, &h1);
418 422
419 // Send a handle over the previously-establish message pipe. 423 // Send a handle over the previously-establish message pipe.
420 ScopedMessagePipeHandle h2; 424 ScopedMessagePipeHandle h2;
421 ScopedMessagePipeHandle h3; 425 ScopedMessagePipeHandle h3;
422 CreateMessagePipe(nullptr, &h2, &h3); 426 MojoCreateMessagePipeOptions options;
427 options.struct_size = sizeof(MojoCreateMessagePipeOptions);
428 options.flags = MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_TRANSFERABLE;
429 if (CreateMessagePipe(&options, &h2, &h3) != MOJO_RESULT_OK)
430 CreateMessagePipe(nullptr, &h2, &h3); // Must be old EDK.
423 431
424 // Write a message to |h2|, before we send |h3|. 432 // Write a message to |h2|, before we send |h3|.
425 const char kWorld[] = "world!"; 433 const char kWorld[] = "world!";
426 const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld)); 434 const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld));
427 EXPECT_EQ(MOJO_RESULT_OK, 435 EXPECT_EQ(MOJO_RESULT_OK,
428 WriteMessageRaw(h2.get(), 436 WriteMessageRaw(h2.get(),
429 kWorld, 437 kWorld,
430 kWorldSize, 438 kWorldSize,
431 nullptr, 439 nullptr,
432 0, 440 0,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 buffer1 = std::move(buffer2); 485 buffer1 = std::move(buffer2);
478 486
479 EXPECT_TRUE(buffer1.is_valid()); 487 EXPECT_TRUE(buffer1.is_valid());
480 EXPECT_FALSE(buffer2.is_valid()); 488 EXPECT_FALSE(buffer2.is_valid());
481 } 489 }
482 490
483 // TODO(vtl): Write data pipe tests. 491 // TODO(vtl): Write data pipe tests.
484 492
485 } // namespace 493 } // namespace
486 } // namespace mojo 494 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/environment/logging.h ('k') | mojo/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698