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

Unified Diff: mojo/common/test/multiprocess_test_base_unittest.cc

Issue 137273003: Mojo: Rename PlatformChannelHandle to PlatformHandle, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/common/test/multiprocess_test_base.cc ('k') | mojo/mojo.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/test/multiprocess_test_base_unittest.cc
diff --git a/mojo/common/test/multiprocess_test_base_unittest.cc b/mojo/common/test/multiprocess_test_base_unittest.cc
index e2c19039be6871698a1db5ea9b5a04d168315b5a..6c8d756f24fba046263fcddb813c44af772f0713 100644
--- a/mojo/common/test/multiprocess_test_base_unittest.cc
+++ b/mojo/common/test/multiprocess_test_base_unittest.cc
@@ -6,8 +6,7 @@
#include "base/logging.h"
#include "build/build_config.h"
-#include "mojo/system/platform_channel.h"
-#include "mojo/system/platform_channel_handle.h"
+#include "mojo/system/scoped_platform_handle.h"
#if defined(OS_POSIX)
#include <fcntl.h>
@@ -25,8 +24,7 @@ class MultiprocessTestBaseTest : public test::MultiprocessTestBase {
TEST_F(MultiprocessTestBaseTest, RunChild) {
// TODO(vtl): Not implemented on Windows yet.
#if defined(OS_POSIX)
- EXPECT_TRUE(server_platform_channel.get());
- EXPECT_TRUE(server_platform_channel->is_valid());
+ EXPECT_TRUE(server_platform_handle.is_valid());
#endif
StartChild("RunChild");
EXPECT_EQ(123, WaitForChildShutdown());
@@ -35,8 +33,7 @@ TEST_F(MultiprocessTestBaseTest, RunChild) {
MOJO_MULTIPROCESS_TEST_CHILD_MAIN(RunChild) {
// TODO(vtl): Not implemented on Windows yet.
#if defined(OS_POSIX)
- CHECK(MultiprocessTestBaseTest::client_platform_channel.get());
- CHECK(MultiprocessTestBaseTest::client_platform_channel->is_valid());
+ CHECK(MultiprocessTestBaseTest::client_platform_handle.is_valid());
#endif
return 123;
}
@@ -47,19 +44,16 @@ TEST_F(MultiprocessTestBaseTest, TestChildMainNotFound) {
EXPECT_FALSE(result >= 0 && result <= 127);
}
-// POSIX-specific test of passed channel ---------------------------------------
+// POSIX-specific test of passed handle ----------------------------------------
#if defined(OS_POSIX)
TEST_F(MultiprocessTestBaseTest, PassedChannelPosix) {
- EXPECT_TRUE(server_platform_channel.get());
- EXPECT_TRUE(server_platform_channel->is_valid());
+ EXPECT_TRUE(server_platform_handle.is_valid());
StartChild("PassedChannelPosix");
// Take ownership of the FD.
- mojo::system::PlatformChannelHandle channel =
- server_platform_channel->PassHandle();
- server_platform_channel.reset();
- int fd = channel.fd;
+ system::ScopedPlatformHandle handle = server_platform_handle.Pass();
+ int fd = handle.get().fd;
// The FD should be non-blocking. Check this.
CHECK((fcntl(fd, F_GETFL) & O_NONBLOCK));
@@ -82,14 +76,12 @@ TEST_F(MultiprocessTestBaseTest, PassedChannelPosix) {
}
MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PassedChannelPosix) {
- CHECK(MultiprocessTestBaseTest::client_platform_channel.get());
- CHECK(MultiprocessTestBaseTest::client_platform_channel->is_valid());
+ CHECK(MultiprocessTestBaseTest::client_platform_handle.is_valid());
// Take ownership of the FD.
- mojo::system::PlatformChannelHandle channel =
- MultiprocessTestBaseTest::client_platform_channel->PassHandle();
- MultiprocessTestBaseTest::client_platform_channel.reset();
- int fd = channel.fd;
+ system::ScopedPlatformHandle handle =
+ MultiprocessTestBaseTest::client_platform_handle.Pass();
+ int fd = handle.get().fd;
// The FD should still be non-blocking. Check this.
CHECK((fcntl(fd, F_GETFL) & O_NONBLOCK));
@@ -106,8 +98,6 @@ MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PassedChannelPosix) {
ssize_t write_size = HANDLE_EINTR(write(fd, &c, 1));
CHECK_EQ(write_size, 1);
- PCHECK(close(fd) == 0);
-
// And return it, incremented again.
c++;
return static_cast<int>(c);
« no previous file with comments | « mojo/common/test/multiprocess_test_base.cc ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698