| OLD | NEW |
| 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 #ifndef IPC_IPC_TEST_BASE_H_ | 5 #ifndef IPC_IPC_TEST_BASE_H_ |
| 6 #define IPC_IPC_TEST_BASE_H_ | 6 #define IPC_IPC_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 // The channel name is based on the client's name. This is a public static | 28 // The channel name is based on the client's name. This is a public static |
| 29 // helper to be used by the client-side code; server-side test code should | 29 // helper to be used by the client-side code; server-side test code should |
| 30 // usually not use this (directly). | 30 // usually not use this (directly). |
| 31 static std::string GetChannelName(const std::string& test_client_name); | 31 static std::string GetChannelName(const std::string& test_client_name); |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 IPCTestBase(); | 34 IPCTestBase(); |
| 35 virtual ~IPCTestBase(); | 35 virtual ~IPCTestBase(); |
| 36 | 36 |
| 37 virtual void TearDown() OVERRIDE; | 37 virtual void TearDown() override; |
| 38 | 38 |
| 39 // Initializes the test to use the given client and creates an IO message loop | 39 // Initializes the test to use the given client and creates an IO message loop |
| 40 // on the current thread. | 40 // on the current thread. |
| 41 void Init(const std::string& test_client_name); | 41 void Init(const std::string& test_client_name); |
| 42 // Some tests create separate thread for IO message loop and run non-IO | 42 // Some tests create separate thread for IO message loop and run non-IO |
| 43 // message loop on the main thread. As IPCTestBase creates IO message loop by | 43 // message loop on the main thread. As IPCTestBase creates IO message loop by |
| 44 // default, such tests need to provide a custom message loop for the main | 44 // default, such tests need to provide a custom message loop for the main |
| 45 // thread. | 45 // thread. |
| 46 void InitWithCustomMessageLoop(const std::string& test_client_name, | 46 void InitWithCustomMessageLoop(const std::string& test_client_name, |
| 47 scoped_ptr<base::MessageLoop> message_loop); | 47 scoped_ptr<base::MessageLoop> message_loop); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 base::ProcessHandle client_process_; | 120 base::ProcessHandle client_process_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); | 122 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Use this to declare the client side for tests using IPCTestBase. | 125 // Use this to declare the client side for tests using IPCTestBase. |
| 126 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ | 126 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ |
| 127 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) | 127 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) |
| 128 | 128 |
| 129 #endif // IPC_IPC_TEST_BASE_H_ | 129 #endif // IPC_IPC_TEST_BASE_H_ |
| OLD | NEW |