summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_fuzzing_tests.cc
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 23:48:34 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 23:48:34 +0000
commitdc90da2c3f8c87baa8dcea7fbf0272001d771ecf (patch)
tree99baf8465918e25521eab024315a5aa9ce78734d /chrome/common/ipc_fuzzing_tests.cc
parentbf1b47dfbe8294738c0db628af036e2fd363ddac (diff)
downloadchromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.zip
chromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.tar.gz
chromium_src-dc90da2c3f8c87baa8dcea7fbf0272001d771ecf.tar.bz2
* Add ipc_tests unittest target to xcode project.
* Stub out ipc_channel_posix.cc to allow other code that depends on it to be compiled. * Cleanup some ipc code a bit to compile on gcc. * Remove unused IPC::Channel::ProcessPendingMessages() git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6181 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_fuzzing_tests.cc')
-rw-r--r--chrome/common/ipc_fuzzing_tests.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/common/ipc_fuzzing_tests.cc b/chrome/common/ipc_fuzzing_tests.cc
index 4b7563b..9216df9 100644
--- a/chrome/common/ipc_fuzzing_tests.cc
+++ b/chrome/common/ipc_fuzzing_tests.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
@@ -10,6 +9,8 @@
#include "chrome/common/ipc_tests.h"
+#include "base/platform_thread.h"
+#include "base/process_util.h"
#include "chrome/common/ipc_channel.h"
#include "chrome/common/ipc_channel_proxy.h"
#include "chrome/common/ipc_message_utils.h"
@@ -209,7 +210,7 @@ class FuzzerServerListener : public SimpleListener {
std::wostringstream wos;
wos << L"IPC fuzzer:" << caller << " [" << value << L" " << text << L"]\n";
std::wstring output = wos.str();
- ::OutputDebugStringW(output.c_str());
+ LOG(WARNING) << output.c_str();
};
int message_count_;
@@ -275,9 +276,9 @@ bool RunFuzzServer() {
// This test makes sure that the FuzzerClientListener and FuzzerServerListener
// are working properly by generating two well formed IPC calls.
TEST(IPCFuzzingTest, SanityTest) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- ::Sleep(1000);
+ PlatformThread::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -294,7 +295,7 @@ TEST(IPCFuzzingTest, SanityTest) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(value, MsgClassSI::ID));
- ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
}
// This test uses a payload that is smaller than expected.
@@ -304,7 +305,7 @@ TEST(IPCFuzzingTest, SanityTest) {
// properly.
#ifdef NDEBUG
TEST(IPCFuzzingTest, MsgBadPayloadShort) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
::Sleep(1000);
FuzzerClientListener listener;
@@ -333,9 +334,9 @@ TEST(IPCFuzzingTest, MsgBadPayloadShort) {
// This test does not pinpoint a flaw (per se) as by design we don't carry
// type information on the IPC message.
TEST(IPCFuzzingTest, MsgBadPayloadArgs) {
- HANDLE server_process = SpawnChild(FUZZER_SERVER);
+ base::ProcessHandle server_process = SpawnChild(FUZZER_SERVER);
ASSERT_TRUE(server_process);
- ::Sleep(1000);
+ PlatformThread::Sleep(1000);
FuzzerClientListener listener;
IPC::Channel chan(kFuzzerChannel, IPC::Channel::MODE_CLIENT,
&listener);
@@ -355,7 +356,7 @@ TEST(IPCFuzzingTest, MsgBadPayloadArgs) {
chan.Send(msg);
EXPECT_TRUE(listener.ExpectMessage(3, MsgClassIS::ID));
- ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(server_process, 5000));
+ EXPECT_TRUE(base::WaitForSingleProcess(server_process, 5000));
}
// This class is for testing the IPC_BEGIN_MESSAGE_MAP_EX macros.