| OLD | NEW |
| 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 #ifndef BASE_TEST_MULTIPROCESS_TEST_H_ | 5 #ifndef BASE_TEST_MULTIPROCESS_TEST_H_ |
| 6 #define BASE_TEST_MULTIPROCESS_TEST_H_ | 6 #define BASE_TEST_MULTIPROCESS_TEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // added. Note: On Windows, you probably want to set |options.start_hidden|. | 59 // added. Note: On Windows, you probably want to set |options.start_hidden|. |
| 60 Process SpawnMultiProcessTestChild( | 60 Process SpawnMultiProcessTestChild( |
| 61 const std::string& procname, | 61 const std::string& procname, |
| 62 const CommandLine& command_line, | 62 const CommandLine& command_line, |
| 63 const LaunchOptions& options); | 63 const LaunchOptions& options); |
| 64 | 64 |
| 65 // Gets the base command line for |SpawnMultiProcessTestChild()|. To this, you | 65 // Gets the base command line for |SpawnMultiProcessTestChild()|. To this, you |
| 66 // may add any flags needed for your child process. | 66 // may add any flags needed for your child process. |
| 67 CommandLine GetMultiProcessTestChildBaseCommandLine(); | 67 CommandLine GetMultiProcessTestChildBaseCommandLine(); |
| 68 | 68 |
| 69 #if defined(OS_ANDROID) |
| 70 |
| 71 // Enable the alternate test child implementation which support spawning a child |
| 72 // after threads have been created. If used, this MUST be the first line of |
| 73 // main(). The main function is passed in to avoid a link-time dependency in |
| 74 // component builds. |
| 75 void InitAndroidMultiProcessTestHelper(int (*main)(int, char**)); |
| 76 |
| 77 // Wait for a test child to exit if the alternate test child implementation is |
| 78 // being used. |
| 79 bool AndroidWaitForChildExitWithTimeout( |
| 80 const Process& process, TimeDelta timeout, int* exit_code) |
| 81 WARN_UNUSED_RESULT; |
| 82 |
| 83 #endif // defined(OS_ANDROID) |
| 84 |
| 69 // MultiProcessTest ------------------------------------------------------------ | 85 // MultiProcessTest ------------------------------------------------------------ |
| 70 | 86 |
| 71 // A MultiProcessTest is a test class which makes it easier to | 87 // A MultiProcessTest is a test class which makes it easier to |
| 72 // write a test which requires code running out of process. | 88 // write a test which requires code running out of process. |
| 73 // | 89 // |
| 74 // To create a multiprocess test simply follow these steps: | 90 // To create a multiprocess test simply follow these steps: |
| 75 // | 91 // |
| 76 // 1) Derive your test from MultiProcessTest. Example: | 92 // 1) Derive your test from MultiProcessTest. Example: |
| 77 // | 93 // |
| 78 // class MyTest : public MultiProcessTest { | 94 // class MyTest : public MultiProcessTest { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // |ModifyChildCommandLine()|; make the two divergent uses more sane. | 138 // |ModifyChildCommandLine()|; make the two divergent uses more sane. |
| 123 virtual CommandLine MakeCmdLine(const std::string& procname); | 139 virtual CommandLine MakeCmdLine(const std::string& procname); |
| 124 | 140 |
| 125 private: | 141 private: |
| 126 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); | 142 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); |
| 127 }; | 143 }; |
| 128 | 144 |
| 129 } // namespace base | 145 } // namespace base |
| 130 | 146 |
| 131 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ | 147 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ |
| OLD | NEW |