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

Unified Diff: ipc/ipc_fuzzing_tests.cc

Issue 2451953003: Change most IPC tests to use ChannelMojo. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_channel_proxy_unittest.cc ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_fuzzing_tests.cc
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index 2cf58950e3d8bc6287b82b961ddf052ff6284aff..8e385bc34fe828bca88d781a26628dab6e7da953 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -258,20 +258,15 @@ class FuzzerClientListener : public SimpleListener {
// Runs the fuzzing server child mode. Returns when the preset number of
// messages have been received.
-MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) {
- base::MessageLoopForIO main_message_loop;
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(FuzzServerClient) {
FuzzerServerListener listener;
- std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
- IPCTestBase::GetChannelName("FuzzServerClient"), &listener,
- main_message_loop.task_runner()));
- CHECK(channel->Connect());
- listener.Init(channel.get());
+ Connect(&listener);
+ listener.Init(channel());
base::RunLoop().Run();
- return 0;
+ Close();
}
-class IPCFuzzingTest : public IPCTestBase {
-};
+using IPCFuzzingTest = IPCChannelMojoTestBase;
// This test makes sure that the FuzzerClientListener and FuzzerServerListener
// are working properly by generating two well formed IPC calls.
@@ -282,7 +277,6 @@ TEST_F(IPCFuzzingTest, SanityTest) {
CreateChannel(&listener);
listener.Init(channel());
ASSERT_TRUE(ConnectChannel());
- ASSERT_TRUE(StartClient());
IPC::Message* msg = NULL;
int value = 43;
@@ -299,10 +293,8 @@ TEST_F(IPCFuzzingTest, SanityTest) {
}
// This test uses a payload that is smaller than expected. This generates an
-// error while unpacking the IPC buffer which in debug trigger an assertion and
-// in release is ignored (!). Right after we generate another valid IPC to make
-// sure framing is working properly.
-#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
+// error while unpacking the IPC buffer. Right after we generate another valid
+// IPC to make sure framing is working properly.
TEST_F(IPCFuzzingTest, MsgBadPayloadShort) {
Init("FuzzServerClient");
@@ -310,7 +302,6 @@ TEST_F(IPCFuzzingTest, MsgBadPayloadShort) {
CreateChannel(&listener);
listener.Init(channel());
ASSERT_TRUE(ConnectChannel());
- ASSERT_TRUE(StartClient());
IPC::Message* msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
IPC::Message::PRIORITY_NORMAL);
@@ -325,7 +316,6 @@ TEST_F(IPCFuzzingTest, MsgBadPayloadShort) {
EXPECT_TRUE(WaitForClientShutdown());
DestroyChannel();
}
-#endif
// This test uses a payload that has too many arguments, but so the payload size
// is big enough so the unpacking routine does not generate an error as in the
@@ -338,7 +328,6 @@ TEST_F(IPCFuzzingTest, MsgBadPayloadArgs) {
CreateChannel(&listener);
listener.Init(channel());
ASSERT_TRUE(ConnectChannel());
- ASSERT_TRUE(StartClient());
IPC::Message* msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassSI::ID,
IPC::Message::PRIORITY_NORMAL);
« no previous file with comments | « ipc/ipc_channel_proxy_unittest.cc ('k') | ipc/ipc_send_fds_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698