OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "files/public/c/lib/fd_table.h" | 5 #include "files/c/lib/fd_table.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "files/public/c/lib/fd_impl.h" | 11 #include "files/c/lib/fd_impl.h" |
12 #include "files/public/c/tests/mock_errno_impl.h" | 12 #include "files/c/tests/mock_errno_impl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace mojio { | 15 namespace mojio { |
16 namespace { | 16 namespace { |
17 | 17 |
18 class TestFDImpl : public FDImpl { | 18 class TestFDImpl : public FDImpl { |
19 public: | 19 public: |
20 TestFDImpl() : FDImpl(nullptr) {} | 20 TestFDImpl() : FDImpl(nullptr) {} |
21 ~TestFDImpl() override {} | 21 ~TestFDImpl() override {} |
22 | 22 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 EXPECT_EQ(kLastErrorSentinel, errno_impl.Get()); // No error. | 170 EXPECT_EQ(kLastErrorSentinel, errno_impl.Get()); // No error. |
171 | 171 |
172 // Now adding should be okay again. | 172 // Now adding should be okay again. |
173 errno_impl.Reset(kLastErrorSentinel); | 173 errno_impl.Reset(kLastErrorSentinel); |
174 EXPECT_EQ(0, fd_table.Add(std::unique_ptr<FDImpl>(new TestFDImpl()))); | 174 EXPECT_EQ(0, fd_table.Add(std::unique_ptr<FDImpl>(new TestFDImpl()))); |
175 EXPECT_EQ(kLastErrorSentinel, errno_impl.Get()); // No error. | 175 EXPECT_EQ(kLastErrorSentinel, errno_impl.Get()); // No error. |
176 } | 176 } |
177 | 177 |
178 } // namespace | 178 } // namespace |
179 } // namespace mojio | 179 } // namespace mojio |
OLD | NEW |