OLD | NEW |
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2013 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 <string.h> | 8 #include <string.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "gtest/gtest.h" | 12 #include "gtest/gtest.h" |
13 #include "nacl_io/ioctl.h" | 13 #include "nacl_io/ioctl.h" |
14 #include "nacl_io/mount.h" | 14 #include "nacl_io/mount.h" |
15 #include "nacl_io/mount_dev.h" | 15 #include "nacl_io/mount_dev.h" |
16 #include "nacl_io/mount_mem.h" | 16 #include "nacl_io/mount_mem.h" |
17 #include "nacl_io/osdirent.h" | 17 #include "nacl_io/osdirent.h" |
18 #include "nacl_io/osunistd.h" | 18 #include "nacl_io/osunistd.h" |
19 | 19 |
| 20 using namespace nacl_io; |
| 21 |
20 namespace { | 22 namespace { |
21 | 23 |
22 class MountMemMock : public MountMem { | 24 class MountMemMock : public MountMem { |
23 public: | 25 public: |
24 MountMemMock() { | 26 MountMemMock() { |
25 StringMap_t map; | 27 StringMap_t map; |
26 EXPECT_EQ(0, Init(1, map, NULL)); | 28 EXPECT_EQ(0, Init(1, map, NULL)); |
27 } | 29 } |
28 | 30 |
29 int num_nodes() { return (int) inode_pool_.size(); } | 31 int num_nodes() { return (int) inode_pool_.size(); } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 100 - content.size())); | 360 100 - content.size())); |
359 | 361 |
360 // Now we try to send something with an invalid prefix | 362 // Now we try to send something with an invalid prefix |
361 std::string bogus_message("Woah there, this message has no valid prefix"); | 363 std::string bogus_message("Woah there, this message has no valid prefix"); |
362 struct tioc_nacl_input_string bogus_pack; | 364 struct tioc_nacl_input_string bogus_pack; |
363 bogus_pack.length = bogus_message.size(); | 365 bogus_pack.length = bogus_message.size(); |
364 bogus_pack.buffer = bogus_message.data(); | 366 bogus_pack.buffer = bogus_message.data(); |
365 EXPECT_EQ(ENOTTY, dev_tty->Ioctl(TIOCNACLINPUT, | 367 EXPECT_EQ(ENOTTY, dev_tty->Ioctl(TIOCNACLINPUT, |
366 reinterpret_cast<char*>(&bogus_pack))); | 368 reinterpret_cast<char*>(&bogus_pack))); |
367 } | 369 } |
OLD | NEW |