summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 01:41:02 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 01:41:02 +0000
commite5a3ea33e830593b16f140429896940be276f1ca (patch)
tree644bb19e369267579039eff7d3bb6187cb8b63dc
parent96fad1ae382ba77fed2d2330b2e3a9061835b24f (diff)
downloadchromium_src-e5a3ea33e830593b16f140429896940be276f1ca.zip
chromium_src-e5a3ea33e830593b16f140429896940be276f1ca.tar.gz
chromium_src-e5a3ea33e830593b16f140429896940be276f1ca.tar.bz2
Back out parts of r9537 to fix Linux build bustage.
Review URL: http://codereview.chromium.org/20249 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9544 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/ipc_send_fds_test.cc36
1 files changed, 14 insertions, 22 deletions
diff --git a/chrome/common/ipc_send_fds_test.cc b/chrome/common/ipc_send_fds_test.cc
index d99082b..ca22bd5 100644
--- a/chrome/common/ipc_send_fds_test.cc
+++ b/chrome/common/ipc_send_fds_test.cc
@@ -21,7 +21,6 @@ extern "C" {
namespace {
-const int kNumFDsToSend = 200;
const char* kDevRandomPath = "/dev/random";
static void VerifyAndCloseDescriptor(int fd, ino_t inode_num) {
@@ -43,22 +42,18 @@ static void VerifyAndCloseDescriptor(int fd, ino_t inode_num) {
class MyChannelDescriptorListener : public IPC::Channel::Listener {
public:
MyChannelDescriptorListener(ino_t expected_inode_num)
- : expected_inode_num_(expected_inode_num),
- num_fds_received_(0) {}
+ : expected_inode_num_(expected_inode_num) {}
virtual void OnMessageReceived(const IPC::Message& message) {
void* iter = NULL;
- ++num_fds_received_;
FileDescriptor descriptor;
+
ASSERT_TRUE(
IPC::ParamTraits<FileDescriptor>::Read(&message, &iter, &descriptor));
VerifyAndCloseDescriptor(descriptor.fd, expected_inode_num_);
-
- if (num_fds_received_ == kNumFDsToSend) {
- MessageLoop::current()->Quit();
- }
+ MessageLoop::current()->Quit();
}
virtual void OnChannelError() {
@@ -66,26 +61,23 @@ class MyChannelDescriptorListener : public IPC::Channel::Listener {
}
private:
ino_t expected_inode_num_;
- int num_fds_received_;
};
void TestDescriptorServer(IPC::Channel &chan,
base::ProcessHandle process_handle) {
ASSERT_TRUE(process_handle);
- for (int i = 0; i < kNumFDsToSend; ++i) {
- FileDescriptor descriptor;
- const int fd = open(kDevRandomPath, O_RDONLY);
- ASSERT_GE(fd, 0);
- descriptor.auto_close = true;
- descriptor.fd = fd;
-
- IPC::Message* message = new IPC::Message(0, // routing_id
- 3, // message type
- IPC::Message::PRIORITY_NORMAL);
- IPC::ParamTraits<FileDescriptor>::Write(message, descriptor);
- chan.Send(message);
- }
+ FileDescriptor descriptor;
+ const int fd = open(kDevRandomPath, O_RDONLY);
+ ASSERT_GE(fd, 0);
+ descriptor.auto_close = true;
+ descriptor.fd = fd;
+
+ IPC::Message* message = new IPC::Message(0, // routing_id
+ 3, // message type
+ IPC::Message::PRIORITY_NORMAL);
+ IPC::ParamTraits<FileDescriptor>::Write(message, descriptor);
+ chan.Send(message);
// Run message loop.
MessageLoop::current()->Run();