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

Side by Side Diff: ipc/ipc_channel_posix_unittest.cc

Issue 1259823002: Remove Android filter file for ipc_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remaining tests Created 5 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
« no previous file with comments | « build/android/pylib/gtest/filter/ipc_tests_disabled ('k') | ipc/ipc_channel_proxy_unittest.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 "OUT", base::FileDescriptor(in_chan->TakeClientFileDescriptor())); 273 "OUT", base::FileDescriptor(in_chan->TakeClientFileDescriptor()));
274 scoped_ptr<IPC::ChannelPosix> out_chan(new IPC::ChannelPosix( 274 scoped_ptr<IPC::ChannelPosix> out_chan(new IPC::ChannelPosix(
275 out_handle, IPC::Channel::MODE_CLIENT, &out_listener, nullptr)); 275 out_handle, IPC::Channel::MODE_CLIENT, &out_listener, nullptr));
276 ASSERT_TRUE(in_chan->Connect()); 276 ASSERT_TRUE(in_chan->Connect());
277 in_chan->Close(); // simulate remote process dying at an unfortunate time. 277 in_chan->Close(); // simulate remote process dying at an unfortunate time.
278 ASSERT_FALSE(out_chan->Connect()); 278 ASSERT_FALSE(out_chan->Connect());
279 SpinRunLoop(TestTimeouts::action_max_timeout()); 279 SpinRunLoop(TestTimeouts::action_max_timeout());
280 ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, out_listener.status()); 280 ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, out_listener.status());
281 } 281 }
282 282
283 TEST_F(IPCChannelPosixTest, AdvancedConnected) { 283 #if defined(OS_ANDROID)
284 #define MAYBE_AdvancedConnected DISABLED_AdvancedConnected
285 #else
286 #define MAYBE_AdvancedConnected AdvancedConnected
287 #endif
288 TEST_F(IPCChannelPosixTest, MAYBE_AdvancedConnected) {
284 // Test creating a connection to an external process. 289 // Test creating a connection to an external process.
285 IPCChannelPosixTestListener listener(false); 290 IPCChannelPosixTestListener listener(false);
286 IPC::ChannelHandle chan_handle(GetConnectionSocketName()); 291 IPC::ChannelHandle chan_handle(GetConnectionSocketName());
287 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER); 292 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER);
288 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix( 293 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix(
289 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr)); 294 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr));
290 ASSERT_TRUE(channel->Connect()); 295 ASSERT_TRUE(channel->Connect());
291 ASSERT_TRUE(channel->AcceptsConnections()); 296 ASSERT_TRUE(channel->AcceptsConnections());
292 ASSERT_FALSE(channel->HasAcceptedConnection()); 297 ASSERT_FALSE(channel->HasAcceptedConnection());
293 298
294 base::Process process = SpawnChild("IPCChannelPosixTestConnectionProc"); 299 base::Process process = SpawnChild("IPCChannelPosixTestConnectionProc");
295 ASSERT_TRUE(process.IsValid()); 300 ASSERT_TRUE(process.IsValid());
296 SpinRunLoop(TestTimeouts::action_max_timeout()); 301 SpinRunLoop(TestTimeouts::action_max_timeout());
297 ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status()); 302 ASSERT_EQ(IPCChannelPosixTestListener::CONNECTED, listener.status());
298 ASSERT_TRUE(channel->HasAcceptedConnection()); 303 ASSERT_TRUE(channel->HasAcceptedConnection());
299 IPC::Message* message = new IPC::Message(0, // routing_id 304 IPC::Message* message = new IPC::Message(0, // routing_id
300 kQuitMessage, // message type 305 kQuitMessage, // message type
301 IPC::Message::PRIORITY_NORMAL); 306 IPC::Message::PRIORITY_NORMAL);
302 channel->Send(message); 307 channel->Send(message);
303 SpinRunLoop(TestTimeouts::action_timeout()); 308 SpinRunLoop(TestTimeouts::action_timeout());
304 int exit_code = 0; 309 int exit_code = 0;
305 EXPECT_TRUE(process.WaitForExit(&exit_code)); 310 EXPECT_TRUE(process.WaitForExit(&exit_code));
306 EXPECT_EQ(0, exit_code); 311 EXPECT_EQ(0, exit_code);
307 ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 312 ASSERT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
308 ASSERT_FALSE(channel->HasAcceptedConnection()); 313 ASSERT_FALSE(channel->HasAcceptedConnection());
309 unlink(chan_handle.name.c_str()); 314 unlink(chan_handle.name.c_str());
310 } 315 }
311 316
312 TEST_F(IPCChannelPosixTest, ResetState) { 317 #if defined(OS_ANDROID)
318 #define MAYBE_ResetState DISABLED_ResetState
319 #else
320 #define MAYBE_ResetState ResetState
321 #endif
322 TEST_F(IPCChannelPosixTest, MAYBE_ResetState) {
313 // Test creating a connection to an external process. Close the connection, 323 // Test creating a connection to an external process. Close the connection,
314 // but continue to listen and make sure another external process can connect 324 // but continue to listen and make sure another external process can connect
315 // to us. 325 // to us.
316 IPCChannelPosixTestListener listener(false); 326 IPCChannelPosixTestListener listener(false);
317 IPC::ChannelHandle chan_handle(GetConnectionSocketName()); 327 IPC::ChannelHandle chan_handle(GetConnectionSocketName());
318 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER); 328 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER);
319 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix( 329 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix(
320 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr)); 330 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr));
321 ASSERT_TRUE(channel->Connect()); 331 ASSERT_TRUE(channel->Connect());
322 ASSERT_TRUE(channel->AcceptsConnections()); 332 ASSERT_TRUE(channel->AcceptsConnections());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 "future-proof_growth_strategies_Continually" 374 "future-proof_growth_strategies_Continually"
365 "pontificate_proactive_potentialities_before" 375 "pontificate_proactive_potentialities_before"
366 "leading-edge_processes"; 376 "leading-edge_processes";
367 EXPECT_GE(strlen(kTooLongName), IPC::kMaxSocketNameLength); 377 EXPECT_GE(strlen(kTooLongName), IPC::kMaxSocketNameLength);
368 IPC::ChannelHandle handle2(kTooLongName); 378 IPC::ChannelHandle handle2(kTooLongName);
369 scoped_ptr<IPC::ChannelPosix> channel2(new IPC::ChannelPosix( 379 scoped_ptr<IPC::ChannelPosix> channel2(new IPC::ChannelPosix(
370 handle2, IPC::Channel::MODE_NAMED_SERVER, NULL, nullptr)); 380 handle2, IPC::Channel::MODE_NAMED_SERVER, NULL, nullptr));
371 EXPECT_FALSE(channel2->Connect()); 381 EXPECT_FALSE(channel2->Connect());
372 } 382 }
373 383
374 TEST_F(IPCChannelPosixTest, MultiConnection) { 384 #if defined(OS_ANDROID)
385 #define MAYBE_MultiConnection DISABLED_MultiConnection
386 #else
387 #define MAYBE_MultiConnection MultiConnection
388 #endif
389 TEST_F(IPCChannelPosixTest, MAYBE_MultiConnection) {
375 // Test setting up a connection to an external process, and then have 390 // Test setting up a connection to an external process, and then have
376 // another external process attempt to connect to us. 391 // another external process attempt to connect to us.
377 IPCChannelPosixTestListener listener(false); 392 IPCChannelPosixTestListener listener(false);
378 IPC::ChannelHandle chan_handle(GetConnectionSocketName()); 393 IPC::ChannelHandle chan_handle(GetConnectionSocketName());
379 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER); 394 SetUpSocket(&chan_handle, IPC::Channel::MODE_NAMED_SERVER);
380 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix( 395 scoped_ptr<IPC::ChannelPosix> channel(new IPC::ChannelPosix(
381 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr)); 396 chan_handle, IPC::Channel::MODE_NAMED_SERVER, &listener, nullptr));
382 ASSERT_TRUE(channel->Connect()); 397 ASSERT_TRUE(channel->Connect());
383 ASSERT_TRUE(channel->AcceptsConnections()); 398 ASSERT_TRUE(channel->AcceptsConnections());
384 ASSERT_FALSE(channel->HasAcceptedConnection()); 399 ASSERT_FALSE(channel->HasAcceptedConnection());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (connected) { 494 if (connected) {
480 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout()); 495 IPCChannelPosixTest::SpinRunLoop(TestTimeouts::action_max_timeout());
481 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status()); 496 EXPECT_EQ(IPCChannelPosixTestListener::CHANNEL_ERROR, listener.status());
482 } else { 497 } else {
483 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status()); 498 EXPECT_EQ(IPCChannelPosixTestListener::DISCONNECTED, listener.status());
484 } 499 }
485 return 0; 500 return 0;
486 } 501 }
487 502
488 } // namespace 503 } // namespace
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/filter/ipc_tests_disabled ('k') | ipc/ipc_channel_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698