Lines Matching refs:file

60   void CleanUp(RandomAccessFile* file) OVERRIDE {  in CleanUp()  argument
61 if (file == nullptr) { in CleanUp()
64 MappedFile* f = ::art::down_cast<MappedFile*>(file); in CleanUp()
74 MappedFile file; in TEST_F() local
75 EXPECT_EQ(-1, file.Fd()); in TEST_F()
76 EXPECT_FALSE(file.IsOpened()); in TEST_F()
77 EXPECT_FALSE(file.IsMapped()); in TEST_F()
81 MappedFile file; in TEST_F() local
82 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode)); in TEST_F()
83 EXPECT_GE(file.Fd(), 0); in TEST_F()
84 EXPECT_TRUE(file.IsOpened()); in TEST_F()
85 EXPECT_EQ(kContent.size(), static_cast<uint64_t>(file.size())); in TEST_F()
86 EXPECT_EQ(0, file.Close()); in TEST_F()
87 EXPECT_EQ(-1, file.Fd()); in TEST_F()
88 EXPECT_FALSE(file.IsOpened()); in TEST_F()
94 MappedFile file(fileno(f), false); in TEST_F() local
95 EXPECT_GE(file.Fd(), 0); in TEST_F()
96 EXPECT_TRUE(file.IsOpened()); in TEST_F()
97 EXPECT_EQ(0, file.Close()); in TEST_F()
101 MappedFile file; in TEST_F() local
102 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode)); in TEST_F()
103 EXPECT_FALSE(file.IsMapped()); in TEST_F()
104 EXPECT_TRUE(file.MapReadOnly()); in TEST_F()
105 EXPECT_TRUE(file.IsMapped()); in TEST_F()
106 EXPECT_EQ(kContent.size(), static_cast<uint64_t>(file.size())); in TEST_F()
107 ASSERT_TRUE(file.data()); in TEST_F()
108 EXPECT_EQ(0, memcmp(kContent.c_str(), file.data(), file.size())); in TEST_F()
109 EXPECT_EQ(0, file.Flush()); in TEST_F()
113 MappedFile file; in TEST_F() local
114 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode)); in TEST_F()
115 EXPECT_FALSE(file.IsMapped()); in TEST_F()
116 EXPECT_TRUE(file.MapReadWrite(1)); in TEST_F()
117 EXPECT_TRUE(file.IsMapped()); in TEST_F()
118 EXPECT_EQ(1, file.size()); in TEST_F()
119 ASSERT_TRUE(file.data()); in TEST_F()
120 EXPECT_EQ(kContent[0], *file.data()); in TEST_F()
121 EXPECT_EQ(0, file.Flush()); in TEST_F()
122 file.Close(); in TEST_F()
130 MappedFile file; in TEST_F() local
131 ASSERT_TRUE(file.Open(new_path, MappedFile::kReadWriteMode)); in TEST_F()
132 EXPECT_TRUE(file.MapReadWrite(kContent.size())); in TEST_F()
133 EXPECT_TRUE(file.IsMapped()); in TEST_F()
134 EXPECT_EQ(kContent.size(), static_cast<uint64_t>(file.size())); in TEST_F()
135 ASSERT_TRUE(file.data()); in TEST_F()
136 memcpy(file.data(), kContent.c_str(), kContent.size()); in TEST_F()
137 EXPECT_EQ(0, file.Flush()); in TEST_F()
138 EXPECT_EQ(0, file.Close()); in TEST_F()
139 EXPECT_FALSE(file.IsMapped()); in TEST_F()
150 MappedFile file; in TEST_F() local
151 EXPECT_FALSE(file.Open(bad_path, MappedFile::kReadOnlyMode)); in TEST_F()
152 EXPECT_EQ(-1, file.Fd()); in TEST_F()
156 MappedFile file; in TEST_F() local
157 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode)); in TEST_F()
158 EXPECT_FALSE(file.MapReadWrite(10)); in TEST_F()
162 MappedFile file; in TEST_F() local
163 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode)); in TEST_F()
164 EXPECT_FALSE(file.MapReadWrite(10)); in TEST_F()
165 EXPECT_FALSE(file.MapReadWrite(10)); in TEST_F()
169 MappedFile file; in TEST_F() local
170 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode)); in TEST_F()
171 ASSERT_TRUE(file.MapReadWrite(10)); in TEST_F()
172 EXPECT_EQ(10, file.GetLength()); in TEST_F()
173 EXPECT_TRUE(file.Unmap()); in TEST_F()
174 EXPECT_TRUE(file.MapReadWrite(20)); in TEST_F()
175 EXPECT_EQ(20, file.GetLength()); in TEST_F()
176 EXPECT_EQ(0, file.Flush()); in TEST_F()
177 EXPECT_TRUE(file.Unmap()); in TEST_F()
178 EXPECT_EQ(0, file.Flush()); in TEST_F()
179 EXPECT_EQ(0, file.SetLength(5)); in TEST_F()
180 EXPECT_TRUE(file.MapReadOnly()); in TEST_F()
181 EXPECT_EQ(5, file.GetLength()); in TEST_F()
197 MappedFile file; in TEST_F() local
198 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode)); in TEST_F()
199 ASSERT_TRUE(file.MapReadOnly()); in TEST_F()
200 TestReadContent(kContent, &file); in TEST_F()
204 MappedFile file; in TEST_F() local
205 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode)); in TEST_F()
206 ASSERT_TRUE(file.MapReadWrite(kContent.size())); in TEST_F()
207 TestReadContent(kContent, &file); in TEST_F()
208 UNUSED(file.FlushClose()); in TEST_F()
213 MappedFile file; in TEST_F() local
214 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode)); in TEST_F()
215 ASSERT_TRUE(file.MapReadWrite(kContent.size())); in TEST_F()
218 EXPECT_EQ(-EINVAL, file.Write(kContent.c_str(), 0, -123)); in TEST_F()
221 EXPECT_EQ(0, file.Write(kContent.c_str(), 0, 0)); in TEST_F()
223 EXPECT_EQ(kContent.size(), static_cast<uint64_t>(file.GetLength())); in TEST_F()
227 static_cast<uint64_t>(file.Write(kContent.c_str(), kContent.size(), 1))); in TEST_F()
228 EXPECT_EQ(0, memcmp(kContent.c_str(), file.data() + 1, kContent.size() - 1)); in TEST_F()
232 static_cast<uint64_t>(file.Write(kContent.c_str(), kContent.size(), 0))); in TEST_F()
233 EXPECT_EQ(0, memcmp(kContent.c_str(), file.data(), kContent.size())); in TEST_F()
234 UNUSED(file.FlushClose()); in TEST_F()
242 MappedFile file;
243 EXPECT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode));
244 EXPECT_DEATH(file.data(), "mapped_");
248 MappedFile file;
249 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode));
250 ASSERT_TRUE(file.MapReadOnly());
251 EXPECT_DEATH(file.MapReadOnly(), "mapped_");
255 MappedFile file;
256 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode));
257 ASSERT_TRUE(file.MapReadWrite(10));
258 EXPECT_DEATH(file.MapReadWrite(10), "mapped_");
262 MappedFile file;
263 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadWriteMode));
264 ASSERT_TRUE(file.MapReadWrite(10));
265 EXPECT_EQ(10, file.GetLength());
266 EXPECT_DEATH(file.SetLength(0), ".*");
270 MappedFile file;
271 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode));
272 ASSERT_TRUE(file.MapReadOnly());
273 EXPECT_EQ(kContent.size(), file.GetLength());
274 EXPECT_DEATH(file.SetLength(0), ".*");
278 MappedFile file;
279 ASSERT_TRUE(file.Open(good_path_, MappedFile::kReadOnlyMode));
280 ASSERT_TRUE(file.MapReadOnly());
282 EXPECT_DEATH(file.Write(buf, 0, 0), ".*");