Index: third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc |
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc |
index 5dc34b1e0998f4cf71da278b9ea70f23e276d70e..48a59c13618427698c990f8054665b6ed757db72 100644 |
--- a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc |
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc |
@@ -7,7 +7,6 @@ |
#include <string.h> |
#include "base/bind.h" |
-#include "base/command_line.h" |
#include "base/location.h" |
#include "base/logging.h" |
#include "base/macros.h" |
@@ -20,7 +19,6 @@ |
#include "mojo/edk/system/test_utils.h" |
#include "mojo/edk/test/multiprocess_test_helper.h" |
#include "mojo/edk/test/scoped_ipc_support.h" |
-#include "mojo/edk/test/test_utils.h" |
#include "mojo/public/c/system/core.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -35,8 +33,6 @@ const MojoHandleSignals kSignalAll = MOJO_HANDLE_SIGNAL_READABLE | |
MOJO_HANDLE_SIGNAL_WRITABLE | |
MOJO_HANDLE_SIGNAL_PEER_CLOSED; |
-const char kConnectionIdFlag[] = "test-connection-id"; |
- |
class ScopedTestChannel { |
public: |
// Creates a channel that lives on a given I/O thread (determined by the given |
@@ -219,7 +215,8 @@ void CloseScopedHandle(ScopedMessagePipeHandle handle) { |
TEST_F(EmbedderTest, AsyncWait) { |
ScopedMessagePipeHandle client_mp; |
ScopedMessagePipeHandle server_mp; |
- EXPECT_EQ(MOJO_RESULT_OK, CreateMessagePipe(nullptr, &client_mp, &server_mp)); |
+ EXPECT_EQ(MOJO_RESULT_OK, |
+ mojo::CreateMessagePipe(nullptr, &client_mp, &server_mp)); |
TestAsyncWaiter waiter; |
EXPECT_EQ(MOJO_RESULT_OK, |
@@ -383,83 +380,6 @@ TEST_F(EmbedderTest, ChannelsHandlePassing) { |
EXPECT_TRUE(client_channel.channel_info()); |
} |
-#if defined(OS_ANDROID) || defined(OS_WIN) |
-// Android multi-process tests are not executing the new process. This is flaky. |
-// TODO(vtl): I'm guessing this is true of this test too? |
-#define MAYBE_MultiprocessMasterSlave DISABLED_MultiprocessMasterSlave |
-#else |
-#define MAYBE_MultiprocessMasterSlave MultiprocessMasterSlave |
-#endif // defined(OS_ANDROID) |
-TEST_F(EmbedderTest, MAYBE_MultiprocessMasterSlave) { |
- mojo::test::ScopedMasterIPCSupport ipc_support(test_io_task_runner()); |
- |
- mojo::test::MultiprocessTestHelper multiprocess_test_helper; |
- ScopedPlatformHandle second_platform_handle; |
- std::string connection_id; |
- ConnectToSlave(nullptr, |
- multiprocess_test_helper.server_platform_handle.Pass(), |
- &second_platform_handle, &connection_id); |
- ASSERT_TRUE(second_platform_handle.is_valid()); |
- ASSERT_FALSE(connection_id.empty()); |
- |
- multiprocess_test_helper.StartChildWithExtraSwitch( |
- "MultiprocessMasterSlave", kConnectionIdFlag, connection_id); |
- |
- // We write a '?'. The slave should write a '!' in response. |
- size_t n = 0; |
- EXPECT_TRUE( |
- mojo::test::BlockingWrite(second_platform_handle.get(), "?", 1, &n)); |
- EXPECT_EQ(1u, n); |
- |
- char c = '\0'; |
- n = 0; |
- EXPECT_TRUE( |
- mojo::test::BlockingRead(second_platform_handle.get(), &c, 1, &n)); |
- EXPECT_EQ(1u, n); |
- EXPECT_EQ('!', c); |
- |
- EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown()); |
-} |
- |
-MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessMasterSlave) { |
- ScopedPlatformHandle client_platform_handle = |
- mojo::test::MultiprocessTestHelper::client_platform_handle.Pass(); |
- EXPECT_TRUE(client_platform_handle.is_valid()); |
- |
- base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart); |
- test::InitWithSimplePlatformSupport(); |
- |
- { |
- mojo::test::ScopedSlaveIPCSupport ipc_support( |
- test_io_thread.task_runner(), client_platform_handle.Pass()); |
- |
- const base::CommandLine& command_line = |
- *base::CommandLine::ForCurrentProcess(); |
- ASSERT_TRUE(command_line.HasSwitch(kConnectionIdFlag)); |
- std::string connection_id = |
- command_line.GetSwitchValueASCII(kConnectionIdFlag); |
- ASSERT_FALSE(connection_id.empty()); |
- ScopedPlatformHandle second_platform_handle; |
- ConnectToMaster(connection_id, &second_platform_handle); |
- ASSERT_TRUE(second_platform_handle.is_valid()); |
- |
- // The master should write a '?'. We'll write a '!' in response. |
- char c = '\0'; |
- size_t n = 0; |
- EXPECT_TRUE( |
- mojo::test::BlockingRead(second_platform_handle.get(), &c, 1, &n)); |
- EXPECT_EQ(1u, n); |
- EXPECT_EQ('?', c); |
- |
- n = 0; |
- EXPECT_TRUE( |
- mojo::test::BlockingWrite(second_platform_handle.get(), "!", 1, &n)); |
- EXPECT_EQ(1u, n); |
- } |
- |
- EXPECT_TRUE(test::Shutdown()); |
-} |
- |
// The sequence of messages sent is: |
// server_mp client_mp mp0 mp1 mp2 mp3 |
// 1. "hello" |