| 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 12 matching lines...) Expand all Loading... |
| 23 class MountRefMock : public Mount { | 23 class MountRefMock : public Mount { |
| 24 public: | 24 public: |
| 25 MountRefMock(int* mount_count, int* handle_count) | 25 MountRefMock(int* mount_count, int* handle_count) |
| 26 : mount_count(mount_count), handle_count(handle_count) { | 26 : mount_count(mount_count), handle_count(handle_count) { |
| 27 (*mount_count)++; | 27 (*mount_count)++; |
| 28 } | 28 } |
| 29 | 29 |
| 30 ~MountRefMock() { (*mount_count)--; } | 30 ~MountRefMock() { (*mount_count)--; } |
| 31 | 31 |
| 32 public: | 32 public: |
| 33 Error Access(const Path& path, int a_mode) { return ENOSYS; } |
| 33 Error Open(const Path& path, int mode, MountNode** out_node) { | 34 Error Open(const Path& path, int mode, MountNode** out_node) { |
| 34 *out_node = NULL; | 35 *out_node = NULL; |
| 35 return ENOSYS; | 36 return ENOSYS; |
| 36 } | 37 } |
| 37 Error Unlink(const Path& path) { return 0; } | 38 Error Unlink(const Path& path) { return 0; } |
| 38 Error Mkdir(const Path& path, int permissions) { return 0; } | 39 Error Mkdir(const Path& path, int permissions) { return 0; } |
| 39 Error Rmdir(const Path& path) { return 0; } | 40 Error Rmdir(const Path& path) { return 0; } |
| 40 Error Remove(const Path& path) { return 0; } | 41 Error Remove(const Path& path) { return 0; } |
| 41 | 42 |
| 42 public: | 43 public: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 189 |
| 189 EXPECT_EQ(1, handle_count); | 190 EXPECT_EQ(1, handle_count); |
| 190 EXPECT_EQ(3, handle->RefCount()); | 191 EXPECT_EQ(3, handle->RefCount()); |
| 191 | 192 |
| 192 proxy->FreeFD(0); | 193 proxy->FreeFD(0); |
| 193 proxy->FreeFD(2); | 194 proxy->FreeFD(2); |
| 194 proxy->ReleaseHandle(handle); // handle is constructed with a refcount of 1. | 195 proxy->ReleaseHandle(handle); // handle is constructed with a refcount of 1. |
| 195 | 196 |
| 196 EXPECT_EQ(0, handle_count); | 197 EXPECT_EQ(0, handle_count); |
| 197 } | 198 } |
| OLD | NEW |