OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "ppapi/tests/test_file_ref.h" | 5 #include "ppapi/tests/test_file_ref.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/c/dev/ppb_file_io_dev.h" | 10 #include "ppapi/c/dev/ppb_file_io_dev.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 TestCompletionCallback callback(instance_->pp_instance()); | 247 TestCompletionCallback callback(instance_->pp_instance()); |
248 | 248 |
249 // Open. | 249 // Open. |
250 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 250 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
251 int32_t rv = file_system.Open(1024, callback); | 251 int32_t rv = file_system.Open(1024, callback); |
252 if (rv == PP_ERROR_WOULDBLOCK) | 252 if (rv == PP_ERROR_WOULDBLOCK) |
253 rv = callback.WaitForResult(); | 253 rv = callback.WaitForResult(); |
254 if (rv != PP_OK) | 254 if (rv != PP_OK) |
255 return ReportError("FileSystem::Open", rv); | 255 return ReportError("FileSystem::Open", rv); |
256 | 256 |
257 // Open aborted (see the DirectoryReader test for comments). | |
258 callback.reset_run_count(); | |
259 rv = pp::FileSystem_Dev(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY) | |
260 .Open(1024, callback); | |
261 if (callback.run_count() > 0) | |
262 return "FileSystem::Open ran callback synchronously."; | |
263 if (rv == PP_ERROR_WOULDBLOCK) { | |
264 rv = callback.WaitForResult(); | |
265 if (rv != PP_ERROR_ABORTED) | |
266 return "FileSystem::Open not aborted."; | |
267 } else if (rv != PP_OK) { | |
268 return ReportError("FileSystem::Open", rv); | |
269 } | |
270 | |
271 // MakeDirectory. | 257 // MakeDirectory. |
272 pp::FileRef_Dev dir_ref(file_system, "/test_dir_make_directory"); | 258 pp::FileRef_Dev dir_ref(file_system, "/test_dir_make_directory"); |
273 rv = dir_ref.MakeDirectory(callback); | 259 rv = dir_ref.MakeDirectory(callback); |
274 if (rv == PP_ERROR_WOULDBLOCK) | 260 if (rv == PP_ERROR_WOULDBLOCK) |
275 rv = callback.WaitForResult(); | 261 rv = callback.WaitForResult(); |
276 if (rv != PP_OK) | 262 if (rv != PP_OK) |
277 return ReportError("FileSystem::MakeDirectory", rv); | 263 return ReportError("FileSystem::MakeDirectory", rv); |
278 | 264 |
279 // MakeDirectory aborted. | 265 // MakeDirectory aborted. |
280 callback.reset_run_count(); | 266 callback.reset_run_count(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 if (rv == PP_ERROR_WOULDBLOCK) { | 556 if (rv == PP_ERROR_WOULDBLOCK) { |
571 rv = callback.WaitForResult(); | 557 rv = callback.WaitForResult(); |
572 if (rv != PP_ERROR_ABORTED) | 558 if (rv != PP_ERROR_ABORTED) |
573 return "FileSystem::Rename not aborted."; | 559 return "FileSystem::Rename not aborted."; |
574 } else if (rv != PP_OK) { | 560 } else if (rv != PP_OK) { |
575 return ReportError("FileSystem::Rename", rv); | 561 return ReportError("FileSystem::Rename", rv); |
576 } | 562 } |
577 | 563 |
578 PASS(); | 564 PASS(); |
579 } | 565 } |
OLD | NEW |