summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_fuzzing_tests.cc
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 16:51:58 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-02 16:51:58 +0000
commitd4651ffb26b0eb01701b01453dcd4479b7ca38eb (patch)
tree3c646cf469cd06bb60c93e98afc0014a8f39c042 /chrome/common/ipc_fuzzing_tests.cc
parent0d83c73b55bd0b5a527f0bcdd26f0d3815d8f938 (diff)
downloadchromium_src-d4651ffb26b0eb01701b01453dcd4479b7ca38eb.zip
chromium_src-d4651ffb26b0eb01701b01453dcd4479b7ca38eb.tar.gz
chromium_src-d4651ffb26b0eb01701b01453dcd4479b7ca38eb.tar.bz2
Try to reland the ipc code to see if the tests
are going to break again. TBR:jeremy Review URL: http://codereview.chromium.org/13053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6222 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.