| 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 TEST_F(KernelProxyErrorTest, ReadError) { | 1109 TEST_F(KernelProxyErrorTest, ReadError) { |
| 1110 ScopedRef<MockFs> mock_fs(fs()); | 1110 ScopedRef<MockFs> mock_fs(fs()); |
| 1111 ScopedRef<MockNode> mock_node(new MockNode(&*mock_fs)); | 1111 ScopedRef<MockNode> mock_node(new MockNode(&*mock_fs)); |
| 1112 EXPECT_CALL(*mock_fs, OpenWithMode(_, _, _, _)) | 1112 EXPECT_CALL(*mock_fs, OpenWithMode(_, _, _, _)) |
| 1113 .WillOnce(DoAll(SetArgPointee<3>(mock_node), Return(0))); | 1113 .WillOnce(DoAll(SetArgPointee<3>(mock_node), Return(0))); |
| 1114 | 1114 |
| 1115 EXPECT_CALL(*mock_node, Read(_, _, _, _)) | 1115 EXPECT_CALL(*mock_node, Read(_, _, _, _)) |
| 1116 .WillOnce(DoAll(SetArgPointee<3>(0), // Read 0 bytes. | 1116 .WillOnce(DoAll(SetArgPointee<3>(0), // Read 0 bytes. |
| 1117 Return(1234))); // Returned error 1234. | 1117 Return(1234))); // Returned error 1234. |
| 1118 | 1118 |
| 1119 EXPECT_CALL(*mock_node, GetType()).WillRepeatedly(Return(S_IFDIR)); |
| 1119 EXPECT_CALL(*mock_node, Destroy()).Times(1); | 1120 EXPECT_CALL(*mock_node, Destroy()).Times(1); |
| 1120 | 1121 |
| 1121 int fd = ki_open("/dummy", O_RDONLY, 0); | 1122 int fd = ki_open("/dummy", O_RDONLY, 0); |
| 1122 EXPECT_NE(0, fd); | 1123 EXPECT_NE(0, fd); |
| 1123 | 1124 |
| 1124 char buf[20]; | 1125 char buf[20]; |
| 1125 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); | 1126 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); |
| 1126 // The Filesystem should be able to return whatever error it wants and have it | 1127 // The Filesystem should be able to return whatever error it wants and have it |
| 1127 // propagate through. | 1128 // propagate through. |
| 1128 EXPECT_EQ(1234, errno); | 1129 EXPECT_EQ(1234, errno); |
| 1129 } | 1130 } |
| OLD | NEW |