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 13 namespace remoting { 14 15 bool MakePipe(base::PlatformFile* read_handle, 16 base::PlatformFile* write_handle) { 17 #if defined(OS_WIN) 18 return CreatePipe(read_handle, write_handle, NULL, 0) != FALSE; 19 #elif defined(OS_POSIX) 20 int fds[2]; 21 if (pipe(fds) == 0) { 22 *read_handle = fds[0]; 23 *write_handle = fds[1]; 24 return true; 25 } 26 return false; 27 #else 28 #error Not implemented 29 #endif 30 } 31 32 } // namepsace remoting 33