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 #include <unistd.h> | |
11 | 10 |
12 #include <map> | 11 #include <map> |
13 #include <string> | 12 #include <string> |
14 | 13 |
15 #include "nacl_mounts/kernel_handle.h" | 14 #include "nacl_mounts/kernel_handle.h" |
16 #include "nacl_mounts/kernel_object.h" | 15 #include "nacl_mounts/kernel_object.h" |
17 #include "nacl_mounts/mount.h" | 16 #include "nacl_mounts/mount.h" |
18 #include "nacl_mounts/path.h" | 17 #include "nacl_mounts/path.h" |
19 | 18 |
20 #define __STDC__ 1 | |
21 #include "gtest/gtest.h" | 19 #include "gtest/gtest.h" |
22 | 20 |
23 int g_MountCnt = 0; | 21 int g_MountCnt = 0; |
24 int g_HandleCnt = 0; | 22 int g_HandleCnt = 0; |
25 | 23 |
26 class MountRefMock : public Mount { | 24 class MountRefMock : public Mount { |
27 public: | 25 public: |
28 MountRefMock() : Mount() { g_MountCnt++; } | 26 MountRefMock() : Mount() { g_MountCnt++; } |
29 ~MountRefMock() { g_MountCnt--; } | 27 ~MountRefMock() { g_MountCnt--; } |
30 | 28 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 112 |
115 proxy->FreeFD(fd3); | 113 proxy->FreeFD(fd3); |
116 EXPECT_EQ(1, g_HandleCnt); | 114 EXPECT_EQ(1, g_HandleCnt); |
117 EXPECT_EQ(1, g_MountCnt); | 115 EXPECT_EQ(1, g_MountCnt); |
118 | 116 |
119 proxy->FreeFD(fd2); | 117 proxy->FreeFD(fd2); |
120 EXPECT_EQ(0, g_HandleCnt); | 118 EXPECT_EQ(0, g_HandleCnt); |
121 EXPECT_EQ(0, g_MountCnt); | 119 EXPECT_EQ(0, g_MountCnt); |
122 } | 120 } |
123 | 121 |
OLD | NEW |