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 "chrome/browser/extensions/api/messaging/native_message_process_host.h" | 5 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 CreateNamedPipeW(pipe_name.c_str(), | 206 CreateNamedPipeW(pipe_name.c_str(), |
207 PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED | | 207 PIPE_ACCESS_OUTBOUND | FILE_FLAG_OVERLAPPED | |
208 FILE_FLAG_FIRST_PIPE_INSTANCE, | 208 FILE_FLAG_FIRST_PIPE_INSTANCE, |
209 PIPE_TYPE_BYTE, 1, 0, 0, 5000, NULL)); | 209 PIPE_TYPE_BYTE, 1, 0, 0, 5000, NULL)); |
210 ASSERT_TRUE(write_handle.IsValid()); | 210 ASSERT_TRUE(write_handle.IsValid()); |
211 base::File read_handle = base::File::CreateForAsyncHandle( | 211 base::File read_handle = base::File::CreateForAsyncHandle( |
212 CreateFileW(pipe_name.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, | 212 CreateFileW(pipe_name.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, |
213 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL)); | 213 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL)); |
214 ASSERT_TRUE(read_handle.IsValid()); | 214 ASSERT_TRUE(read_handle.IsValid()); |
215 | 215 |
216 read_file = read_handle.Pass(); | 216 read_file = std::move(read_handle); |
217 #else // defined(OS_WIN) | 217 #else // defined(OS_WIN) |
218 base::PlatformFile pipe_handles[2]; | 218 base::PlatformFile pipe_handles[2]; |
219 ASSERT_EQ(0, pipe(pipe_handles)); | 219 ASSERT_EQ(0, pipe(pipe_handles)); |
220 read_file = base::File(pipe_handles[0]); | 220 read_file = base::File(pipe_handles[0]); |
221 base::File write_file(pipe_handles[1]); | 221 base::File write_file(pipe_handles[1]); |
222 #endif // !defined(OS_WIN) | 222 #endif // !defined(OS_WIN) |
223 | 223 |
224 scoped_ptr<NativeProcessLauncher> launcher = | 224 scoped_ptr<NativeProcessLauncher> launcher = |
225 FakeLauncher::CreateWithPipeInput(std::move(read_file), temp_output_file); | 225 FakeLauncher::CreateWithPipeInput(std::move(read_file), temp_output_file); |
226 native_message_host_ = NativeMessageProcessHost::CreateWithLauncher( | 226 native_message_host_ = NativeMessageProcessHost::CreateWithLauncher( |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 native_message_host_->Start(this); | 324 native_message_host_->Start(this); |
325 ASSERT_TRUE(native_message_host_.get()); | 325 ASSERT_TRUE(native_message_host_.get()); |
326 run_loop_.reset(new base::RunLoop()); | 326 run_loop_.reset(new base::RunLoop()); |
327 run_loop_->Run(); | 327 run_loop_->Run(); |
328 | 328 |
329 // The host should fail to start. | 329 // The host should fail to start. |
330 ASSERT_TRUE(channel_closed_); | 330 ASSERT_TRUE(channel_closed_); |
331 } | 331 } |
332 | 332 |
333 } // namespace extensions | 333 } // namespace extensions |
OLD | NEW |