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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Loading... |
26 // | 26 // |
27 // TEST_F(MyTest, ATest) { | 27 // TEST_F(MyTest, ATest) { |
28 // CommandLine command_line( | 28 // CommandLine command_line( |
29 // base::GetMultiProcessTestChildBaseCommandLine()); | 29 // base::GetMultiProcessTestChildBaseCommandLine()); |
30 // // Maybe add our own switches to |command_line|.... | 30 // // Maybe add our own switches to |command_line|.... |
31 // | 31 // |
32 // LaunchOptions options; | 32 // LaunchOptions options; |
33 // // Maybe set some options (e.g., |start_hidden| on Windows).... | 33 // // Maybe set some options (e.g., |start_hidden| on Windows).... |
34 // | 34 // |
35 // // Start a child process and run |a_test_func|. | 35 // // Start a child process and run |a_test_func|. |
36 // base::ProcessHandle test_child_handle = | 36 // base::Process test_child_process = |
37 // base::SpawnMultiProcessTestChild("a_test_func", command_line, | 37 // base::SpawnMultiProcessTestChild("a_test_func", command_line, |
38 // options); | 38 // options); |
39 // | 39 // |
40 // // Do stuff involving |test_child_handle| and the child process.... | 40 // // Do stuff involving |test_child_process| and the child process.... |
41 // | 41 // |
42 // int rv = -1; | 42 // int rv = -1; |
43 // ASSERT_TRUE(base::WaitForExitCodeWithTimeout( | 43 // ASSERT_TRUE(test_child_process.WaitForExitWithTimeout( |
44 // test_child_handle, &rv, TestTimeouts::action_timeout())); | 44 // TestTimeouts::action_timeout(), &rv)); |
45 // base::CloseProcessHandle(test_child_handle); | |
46 // EXPECT_EQ(0, rv); | 45 // EXPECT_EQ(0, rv); |
47 // } | 46 // } |
48 // | 47 // |
49 // // Note: |MULTIPROCESS_TEST_MAIN()| is defined in | 48 // // Note: |MULTIPROCESS_TEST_MAIN()| is defined in |
50 // // testing/multi_process_function_list.h. | 49 // // testing/multi_process_function_list.h. |
51 // MULTIPROCESS_TEST_MAIN(a_test_func) { | 50 // MULTIPROCESS_TEST_MAIN(a_test_func) { |
52 // // Code here runs in a child process.... | 51 // // Code here runs in a child process.... |
53 // return 0; | 52 // return 0; |
54 // } | 53 // } |
55 | 54 |
(...skipping 67 matching lines...) Loading... |
123 // |ModifyChildCommandLine()|; make the two divergent uses more sane. | 122 // |ModifyChildCommandLine()|; make the two divergent uses more sane. |
124 virtual CommandLine MakeCmdLine(const std::string& procname); | 123 virtual CommandLine MakeCmdLine(const std::string& procname); |
125 | 124 |
126 private: | 125 private: |
127 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); | 126 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); |
128 }; | 127 }; |
129 | 128 |
130 } // namespace base | 129 } // namespace base |
131 | 130 |
132 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ | 131 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ |
OLD | NEW |