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 #include "multiprocess_func_list.h" | 5 #include "multiprocess_func_list.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 // Helper functions to maintain mapping of "test name"->test func. | 9 // Helper functions to maintain mapping of "test name"->test func. |
10 // The information is accessed via a global map. | 10 // The information is accessed via a global map. |
(...skipping 22 matching lines...) Expand all Loading... |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 AppendMultiProcessTest::AppendMultiProcessTest( | 35 AppendMultiProcessTest::AppendMultiProcessTest( |
36 std::string test_name, | 36 std::string test_name, |
37 TestMainFunctionPtr main_func_ptr, | 37 TestMainFunctionPtr main_func_ptr, |
38 SetupFunctionPtr setup_func_ptr) { | 38 SetupFunctionPtr setup_func_ptr) { |
39 GetMultiprocessFuncMap()[test_name] = | 39 GetMultiprocessFuncMap()[test_name] = |
40 ProcessFunctions(main_func_ptr, setup_func_ptr); | 40 ProcessFunctions(main_func_ptr, setup_func_ptr); |
41 } | 41 } |
42 | 42 |
43 int InvokeChildProcessTest(std::string test_name) { | 43 int InvokeChildProcessTest(const std::string& test_name) { |
44 MultiProcessTestMap& func_lookup_table = GetMultiprocessFuncMap(); | 44 MultiProcessTestMap& func_lookup_table = GetMultiprocessFuncMap(); |
45 MultiProcessTestMap::iterator it = func_lookup_table.find(test_name); | 45 MultiProcessTestMap::iterator it = func_lookup_table.find(test_name); |
46 if (it != func_lookup_table.end()) { | 46 if (it != func_lookup_table.end()) { |
47 const ProcessFunctions& process_functions = it->second; | 47 const ProcessFunctions& process_functions = it->second; |
48 if (process_functions.setup) | 48 if (process_functions.setup) |
49 (*process_functions.setup)(); | 49 (*process_functions.setup)(); |
50 if (process_functions.main) | 50 if (process_functions.main) |
51 return (*process_functions.main)(); | 51 return (*process_functions.main)(); |
52 } | 52 } |
53 | 53 |
54 return -1; | 54 return -1; |
55 } | 55 } |
56 | 56 |
57 } // namespace multi_process_function_list | 57 } // namespace multi_process_function_list |
OLD | NEW |