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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 return 0; | 276 return 0; |
277 } | 277 } |
278 | 278 |
279 private: | 279 private: |
280 int node_mmap_count_; | 280 int node_mmap_count_; |
281 }; | 281 }; |
282 | 282 |
283 class MountMockMMap : public Mount { | 283 class MountMockMMap : public Mount { |
284 public: | 284 public: |
| 285 virtual Error Access(const Path& path, int a_mode) { return 0; } |
| 286 |
285 virtual Error Open(const Path& path, int mode, MountNode** out_node) { | 287 virtual Error Open(const Path& path, int mode, MountNode** out_node) { |
286 MountNodeMockMMap* node = new MountNodeMockMMap(this); | 288 MountNodeMockMMap* node = new MountNodeMockMMap(this); |
287 *out_node = node; | 289 *out_node = node; |
288 return 0; | 290 return 0; |
289 } | 291 } |
290 | 292 |
291 virtual Error OpenResource(const Path& path, MountNode** out_node) { | 293 virtual Error OpenResource(const Path& path, MountNode** out_node) { |
292 *out_node = NULL; | 294 *out_node = NULL; |
293 return ENOSYS; | 295 return ENOSYS; |
294 } | 296 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 EXPECT_EQ(reinterpret_cast<void*>(0x3000), addr3); | 340 EXPECT_EQ(reinterpret_cast<void*>(0x3000), addr3); |
339 EXPECT_EQ(3, g_MMapCount); | 341 EXPECT_EQ(3, g_MMapCount); |
340 | 342 |
341 ki_close(fd); | 343 ki_close(fd); |
342 | 344 |
343 // We no longer track mmap'd regions, so munmap is a no-op. | 345 // We no longer track mmap'd regions, so munmap is a no-op. |
344 EXPECT_EQ(0, ki_munmap(reinterpret_cast<void*>(0x1000), 0x2800)); | 346 EXPECT_EQ(0, ki_munmap(reinterpret_cast<void*>(0x1000), 0x2800)); |
345 // We don't track regions, so the mmap count hasn't changed. | 347 // We don't track regions, so the mmap count hasn't changed. |
346 EXPECT_EQ(3, g_MMapCount); | 348 EXPECT_EQ(3, g_MMapCount); |
347 } | 349 } |
OLD | NEW |