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 3// found in the LICENSE file. 4 5#include "remoting/host/setup/test_util.h" 6 7#if defined(OS_WIN) 8#include <windows.h> 9#elif defined(OS_POSIX) 10#include <unistd.h> 11#endif 12 13namespace remoting { 14 15bool MakePipe(base::File* read_file, 16 base::File* write_file) { 17#if defined(OS_WIN) 18 base::PlatformFile read_handle; 19 base::PlatformFile write_handle; 20 if (!CreatePipe(&read_handle, &write_handle, NULL, 0)) 21 return false; 22 *read_file = base::File(read_handle); 23 *write_file = base::File(write_handle); 24 return true; 25#elif defined(OS_POSIX) 26 int fds[2]; 27 if (pipe(fds) == 0) { 28 *read_file = base::File(fds[0]); 29 *write_file = base::File(fds[1]); 30 return true; 31 } 32 return false; 33#else 34#error Not implemented 35#endif 36} 37 38} // namepsace remoting 39