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

Side by Side Diff: ipc/ipc_channel_posix_unittest.cc

Issue 7486007: Fix NamedProxyLauncher on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // These tests are POSIX only. 5 // These tests are POSIX only.
6 6
7 #include "ipc/ipc_channel_posix.h" 7 #include "ipc/ipc_channel_posix.h"
8 8
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 330 }
331 331
332 TEST_F(IPCChannelPosixTest, BadMode) { 332 TEST_F(IPCChannelPosixTest, BadMode) {
333 // Test setting up two servers with a bad mode. 333 // Test setting up two servers with a bad mode.
334 IPCChannelPosixTestListener listener(false); 334 IPCChannelPosixTestListener listener(false);
335 IPC::ChannelHandle chan_handle(kConnectionSocketTestName); 335 IPC::ChannelHandle chan_handle(kConnectionSocketTestName);
336 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NONE, &listener); 336 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NONE, &listener);
337 ASSERT_FALSE(channel.Connect()); 337 ASSERT_FALSE(channel.Connect());
338 } 338 }
339 339
340 TEST_F(IPCChannelPosixTest, IsNamedServerInitialized) {
341 IPCChannelPosixTestListener listener(false);
342 IPC::ChannelHandle chan_handle(kConnectionSocketTestName);
343 ASSERT_TRUE(file_util::Delete(FilePath(kConnectionSocketTestName), false));
344 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized(
345 kConnectionSocketTestName));
346 IPC::Channel channel(chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener);
347 ASSERT_TRUE(IPC::Channel::IsNamedServerInitialized(
348 kConnectionSocketTestName));
349 channel.Close();
350 ASSERT_FALSE(IPC::Channel::IsNamedServerInitialized(
351 kConnectionSocketTestName));
352 }
353
340 // A long running process that connects to us 354 // A long running process that connects to us
341 MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) { 355 MULTIPROCESS_TEST_MAIN(IPCChannelPosixTestConnectionProc) {
342 MessageLoopForIO message_loop; 356 MessageLoopForIO message_loop;
343 IPCChannelPosixTestListener listener(true); 357 IPCChannelPosixTestListener listener(true);
344 IPC::ChannelHandle handle(IPCChannelPosixTest::kConnectionSocketTestName); 358 IPC::ChannelHandle handle(IPCChannelPosixTest::kConnectionSocketTestName);
345 IPCChannelPosixTest::SetUpSocket(&handle, IPC::Channel::MODE_NAMED_CLIENT); 359 IPCChannelPosixTest::SetUpSocket(&handle, IPC::Channel::MODE_NAMED_CLIENT);
346 IPC::Channel channel(handle, IPC::Channel::MODE_NAMED_CLIENT, &listener); 360 IPC::Channel channel(handle, IPC::Channel::MODE_NAMED_CLIENT, &listener);
347 EXPECT_TRUE(channel.Connect()); 361 EXPECT_TRUE(channel.Connect());
348 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); 362 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms());
349 EXPECT_EQ(IPCChannelPosixTestListener::MESSAGE_RECEIVED, listener.status()); 363 EXPECT_EQ(IPCChannelPosixTestListener::MESSAGE_RECEIVED, listener.status());
(...skipping 16 matching lines...) Expand all
366 bool connected = channel.Connect(); 380 bool connected = channel.Connect();
367 if (connected) { 381 if (connected) {
368 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms()); 382 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout_ms());
369 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 383 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
370 } else { 384 } else {
371 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); 385 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status());
372 } 386 }
373 return 0; 387 return 0;
374 } 388 }
375 389
OLDNEW
« no previous file with comments | « ipc/ipc_channel_posix.cc ('k') | ipc/ipc_channel_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698