1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef TESTS_NACL_IO_TEST_MOCK_NODE_H_
6 #define TESTS_NACL_IO_TEST_MOCK_NODE_H_
8 #include "gmock/gmock.h"
10 #include "nacl_io/filesystem.h"
11 #include "nacl_io/kernel_handle.h"
13 class MockNode
: public nacl_io::Node
{
15 typedef nacl_io::Error Error
;
16 typedef nacl_io::HandleAttr HandleAttr
;
17 typedef nacl_io::ScopedNode ScopedNode
;
19 explicit MockNode(nacl_io::Filesystem
*);
22 MOCK_METHOD1(Init
, Error(int));
23 MOCK_METHOD0(Destroy
, void());
24 MOCK_METHOD0(FSync
, Error());
25 MOCK_METHOD1(FTruncate
, Error(off_t
));
26 MOCK_METHOD4(GetDents
, Error(size_t, struct dirent
*, size_t, int*));
27 MOCK_METHOD1(GetStat
, Error(struct stat
*));
28 MOCK_METHOD2(Ioctl
, Error(int, va_list));
29 MOCK_METHOD4(Read
, Error(const HandleAttr
&, void*, size_t, int*));
30 MOCK_METHOD4(Write
, Error(const HandleAttr
&, const void*, size_t, int*));
31 MOCK_METHOD6(MMap
, Error(void*, size_t, int, int, size_t, void**));
32 MOCK_METHOD0(GetLinks
, int());
33 MOCK_METHOD0(GetMode
, int());
34 MOCK_METHOD0(GetType
, int());
35 MOCK_METHOD1(GetSize
, Error(off_t
*));
36 MOCK_METHOD0(IsaDir
, bool());
37 MOCK_METHOD0(IsaFile
, bool());
38 MOCK_METHOD0(Isatty
, Error());
39 MOCK_METHOD0(ChildCount
, int());
40 MOCK_METHOD2(AddChild
, Error(const std::string
&, const ScopedNode
&));
41 MOCK_METHOD1(RemoveChild
, Error(const std::string
&));
42 MOCK_METHOD2(FindChild
, Error(const std::string
&, ScopedNode
*));
43 MOCK_METHOD0(Link
, void());
44 MOCK_METHOD0(Unlink
, void());
47 #endif // TESTS_NACL_IO_TEST_MOCK_NODE_H_