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

Side by Side Diff: mojo/edk/test/multiprocess_test_helper.h

Issue 1485573002: Remove SimpleBroker and instead use the production broker implementation in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment Created 5 years 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 | « mojo/edk/system/simple_broker.cc ('k') | mojo/edk/test/multiprocess_test_helper.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 5 #ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/process/process.h" 10 #include "base/process/process.h"
11 #include "base/test/multiprocess_test.h" 11 #include "base/test/multiprocess_test.h"
12 #include "base/test/test_timeouts.h" 12 #include "base/test/test_timeouts.h"
13 #include "mojo/edk/embedder/scoped_platform_handle.h" 13 #include "mojo/edk/embedder/scoped_platform_handle.h"
14 #include "mojo/public/cpp/system/macros.h" 14 #include "mojo/public/cpp/system/macros.h"
15 #include "testing/multiprocess_func_list.h" 15 #include "testing/multiprocess_func_list.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 18
19 namespace edk { 19 namespace edk {
20 class PlatformChannelPair; 20 class PlatformChannelPair;
21 21
22 namespace test { 22 namespace test {
23 23
24 extern const char kBrokerHandleSwitch[];
25
24 class MultiprocessTestHelper { 26 class MultiprocessTestHelper {
25 public: 27 public:
26 MultiprocessTestHelper(); 28 MultiprocessTestHelper();
27 ~MultiprocessTestHelper(); 29 ~MultiprocessTestHelper();
28 30
29 // Start a child process and run the "main" function "named" |test_child_name| 31 // Start a child process and run the "main" function "named" |test_child_name|
30 // declared using |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| or 32 // declared using |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| or
31 // |MOJO_MULTIPROCESS_TEST_CHILD_TEST()| (below). 33 // |MOJO_MULTIPROCESS_TEST_CHILD_TEST()| (below).
32 void StartChild(const std::string& test_child_name); 34 void StartChild(const std::string& test_child_name);
33 // Like |StartChild()|, but appends an extra switch (with ASCII value) to the 35 // Like |StartChild()|, but appends an extra switch (with ASCII value) to the
(...skipping 19 matching lines...) Expand all
53 // For use by |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| only: 55 // For use by |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| only:
54 static void ChildSetup(); 56 static void ChildSetup();
55 57
56 // For use in the main process: 58 // For use in the main process:
57 ScopedPlatformHandle server_platform_handle; 59 ScopedPlatformHandle server_platform_handle;
58 60
59 // For use (and only valid) in the child process: 61 // For use (and only valid) in the child process:
60 static ScopedPlatformHandle client_platform_handle; 62 static ScopedPlatformHandle client_platform_handle;
61 63
62 private: 64 private:
65 // Used differently depending on the test.
63 scoped_ptr<PlatformChannelPair> platform_channel_pair_; 66 scoped_ptr<PlatformChannelPair> platform_channel_pair_;
64 67
68 // Used by the broker.
69 scoped_ptr<PlatformChannelPair> broker_platform_channel_pair_;
70
65 // Valid after |StartChild()| and before |WaitForChildShutdown()|. 71 // Valid after |StartChild()| and before |WaitForChildShutdown()|.
66 base::Process test_child_; 72 base::Process test_child_;
67 73
68 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper); 74 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper);
69 }; 75 };
70 76
71 // Use this to declare the child process's "main()" function for tests using 77 // Use this to declare the child process's "main()" function for tests using
72 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's 78 // |MultiprocessTestHelper|. It returns an |int|, which will be the process's
73 // exit code (but see the comment about |WaitForChildShutdown()|). 79 // exit code (but see the comment about |WaitForChildShutdown()|).
74 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ 80 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \
(...skipping 14 matching lines...) Expand all
89 ? 1 \ 95 ? 1 \
90 : 0; \ 96 : 0; \
91 } \ 97 } \
92 void test_child_name##TestChildTest() 98 void test_child_name##TestChildTest()
93 99
94 } // namespace test 100 } // namespace test
95 } // namespace edk 101 } // namespace edk
96 } // namespace mojo 102 } // namespace mojo
97 103
98 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 104 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/simple_broker.cc ('k') | mojo/edk/test/multiprocess_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698