| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // This test is POSIX only. | 5 // This test is POSIX only. | 
| 6 | 6 | 
| 7 #include "ipc/file_descriptor_set_posix.h" |  | 
| 8 |  | 
| 9 #include <unistd.h> | 7 #include <unistd.h> | 
| 10 #include <fcntl.h> | 8 #include <fcntl.h> | 
| 11 | 9 | 
| 12 #include "base/basictypes.h" | 10 #include "base/basictypes.h" | 
| 13 #include "base/eintr_wrapper.h" | 11 #include "base/eintr_wrapper.h" | 
|  | 12 #include "ipc/file_descriptor_set_posix.h" | 
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" | 
| 15 | 14 | 
| 16 namespace { | 15 namespace { | 
| 17 | 16 | 
| 18 // Get a safe file descriptor for test purposes. | 17 // Get a safe file descriptor for test purposes. | 
| 19 int GetSafeFd() { | 18 int GetSafeFd() { | 
| 20   return open("/dev/null", O_RDONLY); | 19   return open("/dev/null", O_RDONLY); | 
| 21 } | 20 } | 
| 22 | 21 | 
| 23 // Returns true if fd was already closed.  Closes fd if not closed. | 22 // Returns true if fd was already closed.  Closes fd if not closed. | 
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 170   scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); | 169   scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); | 
| 171 | 170 | 
| 172   const int fd = GetSafeFd(); | 171   const int fd = GetSafeFd(); | 
| 173   ASSERT_TRUE(set->AddAndAutoClose(fd)); | 172   ASSERT_TRUE(set->AddAndAutoClose(fd)); | 
| 174   set->CommitAll(); | 173   set->CommitAll(); | 
| 175 | 174 | 
| 176   ASSERT_TRUE(VerifyClosed(fd)); | 175   ASSERT_TRUE(VerifyClosed(fd)); | 
| 177 } | 176 } | 
| 178 | 177 | 
| 179 }  // namespace | 178 }  // namespace | 
| OLD | NEW | 
|---|