Lines Matching defs:file_handle
28 void CloseFileHandle(PP_FileHandle file_handle) {
30 CloseHandle(file_handle);
32 close(file_handle);
36 bool WriteFile(PP_FileHandle file_handle, const std::string& contents) {
39 BOOL result = ::WriteFile(file_handle, contents.c_str(), contents.size(),
45 bytes_written = write(file_handle, contents.c_str(), contents.size());
51 bool ReadFile(PP_FileHandle file_handle, std::string* contents) {
58 SetFilePointer(file_handle, 0, NULL, FILE_BEGIN);
61 result = !!::ReadFile(file_handle, buffer, kBufferSize, &bytes_read, NULL);
66 lseek(file_handle, 0, SEEK_SET);
70 bytes_read = read(file_handle, buffer, kBufferSize);
129 PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
133 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
137 ASSERT_TRUE(WriteFile(file_handle, contents));
138 ASSERT_FALSE(ReadFile(file_handle, &read_contents));
139 CloseFileHandle(file_handle);
141 file_handle = FileModuleLocal::OpenFile(instance_,
144 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
146 ASSERT_FALSE(WriteFile(file_handle, contents));
147 ASSERT_TRUE(ReadFile(file_handle, &read_contents));
149 CloseFileHandle(file_handle);
161 PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
165 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
166 ASSERT_TRUE(WriteFile(file_handle, contents));
167 CloseFileHandle(file_handle);
171 file_handle = FileModuleLocal::OpenFile(instance_,
174 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
175 ASSERT_TRUE(ReadFile(file_handle, &read_contents));
177 CloseFileHandle(file_handle);
193 PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
197 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
198 ASSERT_TRUE(WriteFile(file_handle, contents));
199 CloseFileHandle(file_handle);
211 file_handle = FileModuleLocal::OpenFile(
214 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
215 ASSERT_TRUE(WriteFile(file_handle, contents));
216 CloseFileHandle(file_handle);
243 PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
247 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
248 ASSERT_TRUE(WriteFile(file_handle, contents));
249 CloseFileHandle(file_handle);
279 PP_FileHandle file_handle = FileModuleLocal::OpenFile(instance_,
283 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
284 ASSERT_TRUE(WriteFile(file_handle, contents));
285 CloseFileHandle(file_handle);
309 PP_FileHandle file_handle = FileModuleLocal::CreateTemporaryFile(instance_);
310 ASSERT_NE(PP_kInvalidFileHandle, file_handle);
313 ASSERT_TRUE(WriteFile(file_handle, contents));
315 ASSERT_TRUE(ReadFile(file_handle, &read_contents));
318 CloseFileHandle(file_handle);