Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / native_client / src / shared / gio / gio_test_base.h
1 /*
2  * Copyright 2010 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 #ifndef NATIVE_CLIENT_SRC_SHARED_GIO_GIO_TEST_BASE_H_
7 #define NATIVE_CLIENT_SRC_SHARED_GIO_GIO_TEST_BASE_H_
8
9 /*
10  * NaCl Generic I/O test utilities.
11  */
12
13 #include "native_client/src/shared/gio/gio.h"
14
15 const int expected_file_size = 32;
16
17 /** Returns character expected to be at file_pos */
18 char GioExpectedCharAt(char initial_char, int file_pos);
19
20 /** Initializes a GioMemoryFile to conform to requirements of these tests,
21     modulo the length assumption. */
22 void GioInitTestMemFile(char* mem_buff, char initial_char, int in_size);
23
24 /*
25  * Must be given a file with contents:
26  * [initial_char+0, initial_char+1, ..., initial_char+expected_file_size-1]. */
27 void GioReadTestWithOffset(struct Gio* my_file,
28                            char initial_char);
29
30 /** Should be given a scratch file that can be written to without worry. */
31 void GioWriteTest(struct Gio* my_file,
32                   bool fixed_length);
33
34 /*
35  * Must be given a file with contents
36  * [initial_char+0, initial_char+1, ..., initial_char+expected_file_size-1].
37  */
38 void GioSeekTestWithOffset(struct Gio* my_file,
39                            char initial_char,
40                            bool wrap_err);
41
42 /** Closes and destroys the file. */
43 void GioCloseTest(struct Gio* my_file);
44
45 #endif  /* NATIVE_CLIENT_SRC_SHARED_GIO_GIO_TEST_BASE_H_ */