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 | 5 |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 using ::testing::Return; | 31 using ::testing::Return; |
32 using ::testing::SaveArg; | 32 using ::testing::SaveArg; |
33 using ::testing::SetArgPointee; | 33 using ::testing::SetArgPointee; |
34 using ::testing::StrEq; | 34 using ::testing::StrEq; |
35 using ::testing::WithArgs; | 35 using ::testing::WithArgs; |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 class KernelProxyFriend : public KernelProxy { | 39 class KernelProxyFriend : public KernelProxy { |
40 public: | 40 public: |
41 Mount* RootMount() { return mounts_["/"].get(); } | 41 Mount* RootMount() { |
| 42 ScopedMount mnt; |
| 43 Path path; |
| 44 |
| 45 AcquireMountAndRelPath("/", &mnt, &path); |
| 46 return mnt.get(); |
| 47 } |
42 }; | 48 }; |
43 | 49 |
44 class KernelProxyTest : public ::testing::Test { | 50 class KernelProxyTest : public ::testing::Test { |
45 public: | 51 public: |
46 KernelProxyTest() : kp_(new KernelProxyFriend) { | 52 KernelProxyTest() : kp_(new KernelProxyFriend) { |
47 ki_init(kp_); | 53 ki_init(kp_); |
48 // Unmount the passthrough FS and mount a memfs. | 54 // Unmount the passthrough FS and mount a memfs. |
49 EXPECT_EQ(0, kp_->umount("/")); | 55 EXPECT_EQ(0, kp_->umount("/")); |
50 EXPECT_EQ(0, kp_->mount("", "/", "memfs", 0, NULL)); | 56 EXPECT_EQ(0, kp_->mount("", "/", "memfs", 0, NULL)); |
51 } | 57 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 499 |
494 int fd = ki_open("/dummy", O_RDONLY); | 500 int fd = ki_open("/dummy", O_RDONLY); |
495 EXPECT_NE(0, fd); | 501 EXPECT_NE(0, fd); |
496 | 502 |
497 char buf[20]; | 503 char buf[20]; |
498 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); | 504 EXPECT_EQ(-1, ki_read(fd, &buf[0], 20)); |
499 // The Mount should be able to return whatever error it wants and have it | 505 // The Mount should be able to return whatever error it wants and have it |
500 // propagate through. | 506 // propagate through. |
501 EXPECT_EQ(1234, errno); | 507 EXPECT_EQ(1234, errno); |
502 } | 508 } |
OLD | NEW |