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 "content/browser/file_descriptor_info_impl.h" | 5 #include "content/browser/file_descriptor_info_impl.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | |
12 #include "base/posix/eintr_wrapper.h" | 11 #include "base/posix/eintr_wrapper.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 // Get a safe file descriptor for test purposes. | 16 // Get a safe file descriptor for test purposes. |
18 // TODO(morrita) Merge with things in file_descriptor_set_posix_unittest.cc | 17 // TODO(morrita) Merge with things in file_descriptor_set_posix_unittest.cc |
19 int GetSafeFd() { | 18 int GetSafeFd() { |
20 return open("/dev/null", O_RDONLY); | 19 return open("/dev/null", O_RDONLY); |
21 } | 20 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 target->Transfer(testingId1, base::ScopedFD(GetSafeFd())); | 77 target->Transfer(testingId1, base::ScopedFD(GetSafeFd())); |
79 target->Transfer(testingId2, base::ScopedFD(GetSafeFd())); | 78 target->Transfer(testingId2, base::ScopedFD(GetSafeFd())); |
80 | 79 |
81 base::FileHandleMappingVector mapping = | 80 base::FileHandleMappingVector mapping = |
82 target->GetMappingWithIDAdjustment(100); | 81 target->GetMappingWithIDAdjustment(100); |
83 ASSERT_EQ(mapping[0].second, 142); | 82 ASSERT_EQ(mapping[0].second, 142); |
84 ASSERT_EQ(mapping[1].second, 143); | 83 ASSERT_EQ(mapping[1].second, 143); |
85 } | 84 } |
86 | 85 |
87 } // namespace content | 86 } // namespace content |
OLD | NEW |