OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef PAPPI_TESTS_TEST_FILE_IO_H_ | 5 #ifndef PAPPI_TESTS_TEST_FILE_IO_H_ |
6 #define PAPPI_TESTS_TEST_FILE_IO_H_ | 6 #define PAPPI_TESTS_TEST_FILE_IO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/tests/test_case.h" | 10 #include "ppapi/tests/test_case.h" |
11 | 11 |
12 namespace pp { | |
13 class FileSystem_Dev; | |
14 } // namespace pp | |
15 | |
12 class TestFileIO : public TestCase { | 16 class TestFileIO : public TestCase { |
13 public: | 17 public: |
14 explicit TestFileIO(TestingInstance* instance) : TestCase(instance) {} | 18 explicit TestFileIO(TestingInstance* instance) : TestCase(instance) {} |
15 | 19 |
16 // TestCase implementation. | 20 // TestCase implementation. |
17 virtual bool Init(); | 21 virtual bool Init(); |
18 virtual void RunTest(); | 22 virtual void RunTest(); |
19 | 23 |
20 private: | 24 private: |
25 enum OpenExpectation { | |
26 CREATE_IF_NOT_EXIST = 1 << 0, | |
27 NOT_CREATE_IF_NOT_EXIST = 1 << 1, | |
darin (slow to review)
2011/05/23 18:17:42
nit: this reads funny with the two NOTs... also, t
yzshen1
2011/05/23 19:48:06
Done. Thanks! It looks much better this way. :)
O
| |
28 OPEN_IF_EXIST = 1 << 2, | |
29 NOT_OPEN_IF_EXIST = 1 << 3, | |
30 TRUNCATE_IF_EXIST = 1 << 4, | |
31 NOT_TRUNCATE_IF_EXIST = 1 << 5, | |
32 END_OF_PAIR = NOT_TRUNCATE_IF_EXIST, | |
darin (slow to review)
2011/05/23 18:17:42
nit: i'm having trouble making sense of END_OF_PAI
yzshen1
2011/05/23 19:48:06
INVALID_FLAG_COMBINATION is also one kind of open
| |
33 | |
34 INVALID_FLAG_COMBINATION = 1 << 6, | |
35 }; | |
36 | |
21 std::string TestOpen(); | 37 std::string TestOpen(); |
22 std::string TestReadWriteSetLength(); | 38 std::string TestReadWriteSetLength(); |
23 std::string TestTouchQuery(); | 39 std::string TestTouchQuery(); |
24 std::string TestAbortCalls(); | 40 std::string TestAbortCalls(); |
41 | |
42 // Helper method used by TestOpen(). | |
43 // |expectations| is a combination of OpenExpectation values. The followings | |
44 // are considered as valid input: | |
45 // 1) INVALID_FLAG_COMBINATION | |
46 // 2) (NOT_)?CREATE_IF_NOT_EXIST | (NOT_)?OPEN_IF_EXIST | | |
47 // (NOT_)?TRUNCATE_IF_EXIST | |
48 std::string MatchOpenExpectations(pp::FileSystem_Dev* file_system, | |
49 size_t open_flags, | |
50 size_t expectations); | |
25 }; | 51 }; |
26 | 52 |
27 #endif // PAPPI_TESTS_TEST_FILE_IO_H_ | 53 #endif // PAPPI_TESTS_TEST_FILE_IO_H_ |
OLD | NEW |