summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_posix.cc
diff options
context:
space:
mode:
authorepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 06:34:52 +0000
committerepenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 06:34:52 +0000
commite097b93086bf7be065d7400aece5edad6aca1bd6 (patch)
treea7cb6a09bd23cc4be97952689147fed2892a713e /ipc/ipc_channel_posix.cc
parent5408dd86637ca2a5d90b65d32d5bd3bc54c8bbbd (diff)
downloadchromium_src-e097b93086bf7be065d7400aece5edad6aca1bd6.zip
chromium_src-e097b93086bf7be065d7400aece5edad6aca1bd6.tar.gz
chromium_src-e097b93086bf7be065d7400aece5edad6aca1bd6.tar.bz2
IPC: Make ipc_perftests run on Android.
There was several minor issues: - Base perf logging file location was off-limits on Android - Printf needs to be flushed to be visible on Android. - Android needs to reset the 'PipeMap' manually since we can't 'exec' after forking a test process. If we don't do this the Channel thinks we are in a single- process test and tries to open an FD which was closed during forking. - Android's base file descriptor needs to be increased to prevent stomping the android native logging file-descriptor with the default pipe. - The test took too long, so the 'exponent' is reduced from 5 to 3 - We need an APK With this patch the test runs like on other platforms, and lots of testing code is fixed such that it works the same way on all platforms. BUG=345471 Review URL: https://codereview.chromium.org/196343019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix.cc')
-rw-r--r--ipc/ipc_channel_posix.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 2bd0989..11b20ff 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -135,6 +135,9 @@ class PipeMap {
ChannelToFDMap map_;
friend struct DefaultSingletonTraits<PipeMap>;
+#if defined(OS_ANDROID)
+ friend void ::IPC::Channel::NotifyProcessForkedForTesting();
+#endif
};
//------------------------------------------------------------------------------
@@ -159,6 +162,15 @@ bool SocketWriteErrorIsRecoverable() {
}
} // namespace
+
+#if defined(OS_ANDROID)
+// When we fork for simple tests on Android, we can't 'exec', so we need to
+// reset these entries manually to get the expected testing behavior.
+void Channel::NotifyProcessForkedForTesting() {
+ PipeMap::GetInstance()->map_.clear();
+}
+#endif
+
//------------------------------------------------------------------------------
#if defined(OS_LINUX)
@@ -227,7 +239,7 @@ bool Channel::ChannelImpl::CreatePipe(
// 1) It's a channel wrapping a pipe that is given to us.
// 2) It's for a named channel, so we create it.
// 3) It's for a client that we implement ourself. This is used
- // in unittesting.
+ // in single-process unittesting.
// 4) It's the initial IPC channel:
// 4a) Client side: Pull the pipe out of the GlobalDescriptors set.
// 4b) Server side: create the pipe.