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 // Basic tests of things declared in mojio_unistd.h, as well as | 5 // Basic tests of things declared in mojio_unistd.h, as well as |
6 // |mojio_creat()|/|mojio_open()| from mojio_fcntl.h. Note that more thorough | 6 // |mojio_creat()|/|mojio_open()| from mojio_fcntl.h. Note that more thorough |
7 // tests are done more directly at a different level. | 7 // tests are done more directly at a different level. |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string.h> | 10 #include <string.h> |
11 | 11 |
12 #include "files/public/c/mojio_fcntl.h" | 12 #include "files/c/mojio_fcntl.h" |
13 #include "files/public/c/mojio_sys_stat.h" | 13 #include "files/c/mojio_sys_stat.h" |
14 #include "files/public/c/mojio_unistd.h" | 14 #include "files/c/mojio_unistd.h" |
15 #include "files/public/c/tests/mojio_test_base.h" | 15 #include "files/c/tests/mojio_test_base.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 using MojioUnistdTest = mojio::test::MojioTestBase; | 19 using MojioUnistdTest = mojio::test::MojioTestBase; |
20 | 20 |
21 TEST_F(MojioUnistdTest, CreatWriteOpenCloseReadClose) { | 21 TEST_F(MojioUnistdTest, CreatWriteOpenCloseReadClose) { |
22 const char kTestFileName[] = "test_file"; | 22 const char kTestFileName[] = "test_file"; |
23 const char kTestData[] = "Hello mojio!"; | 23 const char kTestData[] = "Hello mojio!"; |
24 | 24 |
25 errno = 12345; | 25 errno = 12345; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 errno = 12345; | 131 errno = 12345; |
132 size = mojio_write(-1, buf, sizeof(buf)); | 132 size = mojio_write(-1, buf, sizeof(buf)); |
133 errno_value = errno; | 133 errno_value = errno; |
134 EXPECT_EQ(-1, size); | 134 EXPECT_EQ(-1, size); |
135 EXPECT_EQ(EBADF, errno_value); | 135 EXPECT_EQ(EBADF, errno_value); |
136 } | 136 } |
137 | 137 |
138 // TODO(vtl): mojio_chdir(), mojio_dup(). | 138 // TODO(vtl): mojio_chdir(), mojio_dup(). |
139 | 139 |
140 } // namespace | 140 } // namespace |
OLD | NEW |