summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_test_base.h
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:13:37 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-11 15:13:37 +0000
commit0cb7d8c8ce8a7261743dbe613ad93495457dd174 (patch)
tree1b7fe8dc10f5b0c06c40466d2c7ecfe7466352a8 /ipc/ipc_test_base.h
parenta3c07c2082a2347b5c74d8b0c0bb9240812d331e (diff)
downloadchromium_src-0cb7d8c8ce8a7261743dbe613ad93495457dd174.zip
chromium_src-0cb7d8c8ce8a7261743dbe613ad93495457dd174.tar.gz
chromium_src-0cb7d8c8ce8a7261743dbe613ad93495457dd174.tar.bz2
Make ipc_tests file structure a little saner and add an ipc_perftests target.
This means that the (one, semi-manual) IPC perf test that we have will build without manual hackery (and do so separately from the ipc_tests target). Review URL: https://chromiumcodereview.appspot.com/11819041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_test_base.h')
-rw-r--r--ipc/ipc_test_base.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/ipc/ipc_test_base.h b/ipc/ipc_test_base.h
new file mode 100644
index 0000000..08d410c
--- /dev/null
+++ b/ipc/ipc_test_base.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IPC_IPC_TEST_BASE_H_
+#define IPC_IPC_TEST_BASE_H_
+
+#include "base/process.h"
+#include "base/test/multiprocess_test.h"
+
+// The different channel names for the child processes.
+extern const char kTestClientChannel[];
+extern const char kReflectorChannel[];
+extern const char kFuzzerChannel[];
+extern const char kSyncSocketChannel[];
+
+class MessageLoopForIO;
+namespace IPC {
+class Channel;
+} // namespace IPC
+
+// Base class to facilitate spawning IPC client processes.
+class IPCTestBase : public base::MultiProcessTest {
+ public:
+ enum ChildType {
+ TEST_CLIENT,
+ TEST_DESCRIPTOR_CLIENT,
+ TEST_DESCRIPTOR_CLIENT_SANDBOXED,
+ TEST_REFLECTOR,
+ FUZZER_SERVER,
+ SYNC_SOCKET_SERVER
+ };
+
+ protected:
+ // Create a new MessageLoopForIO for each test.
+ virtual void SetUp() OVERRIDE;
+ virtual void TearDown() OVERRIDE;
+
+ // Spawns a child process of the specified type
+ base::ProcessHandle SpawnChild(ChildType child_type, IPC::Channel* channel);
+
+ // Created around each test instantiation.
+ MessageLoopForIO* message_loop_;
+};
+
+#endif // IPC_IPC_TEST_BASE_H_