Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: testing/multiprocess_func_list.h

Issue 2001093008: Cleanup: Pass std::string as const reference from testing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/multiprocess_func_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 TESTING_MULTIPROCESS_FUNC_LIST_H_ 5 #ifndef TESTING_MULTIPROCESS_FUNC_LIST_H_
6 #define TESTING_MULTIPROCESS_FUNC_LIST_H_ 6 #define TESTING_MULTIPROCESS_FUNC_LIST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 // This file provides the plumbing to register functions to be executed 10 // This file provides the plumbing to register functions to be executed
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 // |main_func_ptr| is the main function that is run in the child process. 41 // |main_func_ptr| is the main function that is run in the child process.
42 // |setup_func_ptr| is a function run when the global mapping is added. 42 // |setup_func_ptr| is a function run when the global mapping is added.
43 AppendMultiProcessTest(std::string test_name, 43 AppendMultiProcessTest(std::string test_name,
44 TestMainFunctionPtr main_func_ptr, 44 TestMainFunctionPtr main_func_ptr,
45 SetupFunctionPtr setup_func_ptr); 45 SetupFunctionPtr setup_func_ptr);
46 }; 46 };
47 47
48 // Invoke the main function of a test previously registered with 48 // Invoke the main function of a test previously registered with
49 // MULTIPROCESS_TEST_MAIN() 49 // MULTIPROCESS_TEST_MAIN()
50 int InvokeChildProcessTest(std::string test_name); 50 int InvokeChildProcessTest(const std::string& test_name);
51 51
52 // This macro creates a global MultiProcessTest::AppendMultiProcessTest object 52 // This macro creates a global MultiProcessTest::AppendMultiProcessTest object
53 // whose constructor does the work of adding the global mapping. 53 // whose constructor does the work of adding the global mapping.
54 #define MULTIPROCESS_TEST_MAIN(test_main) \ 54 #define MULTIPROCESS_TEST_MAIN(test_main) \
55 MULTIPROCESS_TEST_MAIN_WITH_SETUP(test_main, NULL) 55 MULTIPROCESS_TEST_MAIN_WITH_SETUP(test_main, NULL)
56 56
57 // Same as above but lets callers specify a setup method that is run in the 57 // Same as above but lets callers specify a setup method that is run in the
58 // child process, just before the main function is run. This facilitates 58 // child process, just before the main function is run. This facilitates
59 // adding a generic one-time setup function for multiple tests. 59 // adding a generic one-time setup function for multiple tests.
60 #define MULTIPROCESS_TEST_MAIN_WITH_SETUP(test_main, test_setup) \ 60 #define MULTIPROCESS_TEST_MAIN_WITH_SETUP(test_main, test_setup) \
61 int test_main(); \ 61 int test_main(); \
62 namespace { \ 62 namespace { \
63 multi_process_function_list::AppendMultiProcessTest \ 63 multi_process_function_list::AppendMultiProcessTest \
64 AddMultiProcessTest##_##test_main(#test_main, (test_main), (test_setup)); \ 64 AddMultiProcessTest##_##test_main(#test_main, (test_main), (test_setup)); \
65 } \ 65 } \
66 int test_main() 66 int test_main()
67 67
68 } // namespace multi_process_function_list 68 } // namespace multi_process_function_list
69 69
70 #endif // TESTING_MULTIPROCESS_FUNC_LIST_H_ 70 #endif // TESTING_MULTIPROCESS_FUNC_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | testing/multiprocess_func_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698