OLD | NEW |
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 #include "mojo/edk/test/multiprocess_test_helper.h" | 5 #include "mojo/edk/test/multiprocess_test_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "mojo/edk/embedder/platform_channel_pair.h" | 12 #include "mojo/edk/embedder/platform_channel_pair.h" |
13 | 13 |
| 14 #if defined(OS_WIN) |
| 15 #include "base/win/windows_version.h" |
| 16 #endif |
| 17 |
14 namespace mojo { | 18 namespace mojo { |
15 namespace edk { | 19 namespace edk { |
16 namespace test { | 20 namespace test { |
17 | 21 |
18 MultiprocessTestHelper::MultiprocessTestHelper() { | 22 MultiprocessTestHelper::MultiprocessTestHelper() { |
19 platform_channel_pair_.reset(new PlatformChannelPair()); | 23 platform_channel_pair_.reset(new PlatformChannelPair()); |
20 server_platform_handle = platform_channel_pair_->PassServerHandle(); | 24 server_platform_handle = platform_channel_pair_->PassServerHandle(); |
21 } | 25 } |
22 | 26 |
23 MultiprocessTestHelper::~MultiprocessTestHelper() { | 27 MultiprocessTestHelper::~MultiprocessTestHelper() { |
(...skipping 28 matching lines...) Expand all Loading... |
52 command_line.AppendSwitchASCII(switch_string, switch_value); | 56 command_line.AppendSwitchASCII(switch_string, switch_value); |
53 else | 57 else |
54 command_line.AppendSwitch(switch_string); | 58 command_line.AppendSwitch(switch_string); |
55 } | 59 } |
56 | 60 |
57 base::LaunchOptions options; | 61 base::LaunchOptions options; |
58 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
59 options.fds_to_remap = &handle_passing_info; | 63 options.fds_to_remap = &handle_passing_info; |
60 #elif defined(OS_WIN) | 64 #elif defined(OS_WIN) |
61 options.start_hidden = true; | 65 options.start_hidden = true; |
62 options.handles_to_inherit = &handle_passing_info; | 66 if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
| 67 options.handles_to_inherit = &handle_passing_info; |
| 68 else |
| 69 options.inherit_handles = true; |
63 #else | 70 #else |
64 #error "Not supported yet." | 71 #error "Not supported yet." |
65 #endif | 72 #endif |
66 | 73 |
67 test_child_ = | 74 test_child_ = |
68 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); | 75 base::SpawnMultiProcessTestChild(test_child_main, command_line, options); |
69 platform_channel_pair_->ChildProcessLaunched(); | 76 platform_channel_pair_->ChildProcessLaunched(); |
70 | 77 |
71 CHECK(test_child_.IsValid()); | 78 CHECK(test_child_.IsValid()); |
72 } | 79 } |
(...skipping 19 matching lines...) Expand all Loading... |
92 PlatformChannelPair::PassClientHandleFromParentProcess( | 99 PlatformChannelPair::PassClientHandleFromParentProcess( |
93 *base::CommandLine::ForCurrentProcess()); | 100 *base::CommandLine::ForCurrentProcess()); |
94 } | 101 } |
95 | 102 |
96 // static | 103 // static |
97 ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; | 104 ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle; |
98 | 105 |
99 } // namespace test | 106 } // namespace test |
100 } // namespace edk | 107 } // namespace edk |
101 } // namespace mojo | 108 } // namespace mojo |
OLD | NEW |