| 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 #include "ppapi/tests/test_file_io.h" | 5 #include "ppapi/tests/test_file_io.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 TestCompletionCallback callback; | 94 TestCompletionCallback callback; |
| 95 | 95 |
| 96 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 96 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| 97 pp::FileRef_Dev file_ref(file_system, "/file_open"); | 97 pp::FileRef_Dev file_ref(file_system, "/file_open"); |
| 98 int32_t rv = file_system.Open(1024, callback); | 98 int32_t rv = file_system.Open(1024, callback); |
| 99 if (rv == PP_ERROR_WOULDBLOCK) | 99 if (rv == PP_ERROR_WOULDBLOCK) |
| 100 rv = callback.WaitForResult(); | 100 rv = callback.WaitForResult(); |
| 101 if (rv != PP_OK) | 101 if (rv != PP_OK) |
| 102 return ReportError("FileSystem::Open", rv); | 102 return ReportError("FileSystem::Open", rv); |
| 103 | 103 |
| 104 pp::FileIO_Dev file_io; | 104 pp::FileIO_Dev file_io(instance_); |
| 105 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback); | 105 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_CREATE, callback); |
| 106 if (rv == PP_ERROR_WOULDBLOCK) | 106 if (rv == PP_ERROR_WOULDBLOCK) |
| 107 rv = callback.WaitForResult(); | 107 rv = callback.WaitForResult(); |
| 108 if (rv != PP_OK) | 108 if (rv != PP_OK) |
| 109 return ReportError("FileIO::Open", rv); | 109 return ReportError("FileIO::Open", rv); |
| 110 | 110 |
| 111 // Try opening a file that doesn't exist. | 111 // Try opening a file that doesn't exist. |
| 112 pp::FileRef_Dev nonexistent_file_ref(file_system, "/nonexistent_file"); | 112 pp::FileRef_Dev nonexistent_file_ref(file_system, "/nonexistent_file"); |
| 113 pp::FileIO_Dev nonexistent_file_io; | 113 pp::FileIO_Dev nonexistent_file_io(instance_); |
| 114 rv = nonexistent_file_io.Open( | 114 rv = nonexistent_file_io.Open( |
| 115 nonexistent_file_ref, PP_FILEOPENFLAG_READ, callback); | 115 nonexistent_file_ref, PP_FILEOPENFLAG_READ, callback); |
| 116 if (rv == PP_ERROR_WOULDBLOCK) | 116 if (rv == PP_ERROR_WOULDBLOCK) |
| 117 rv = callback.WaitForResult(); | 117 rv = callback.WaitForResult(); |
| 118 if (rv != PP_ERROR_FILENOTFOUND) | 118 if (rv != PP_ERROR_FILENOTFOUND) |
| 119 return ReportError("FileIO::Open", rv); | 119 return ReportError("FileIO::Open", rv); |
| 120 | 120 |
| 121 PASS(); | 121 PASS(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 std::string TestFileIO::TestReadWriteSetLength() { | 124 std::string TestFileIO::TestReadWriteSetLength() { |
| 125 TestCompletionCallback callback; | 125 TestCompletionCallback callback; |
| 126 | 126 |
| 127 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 127 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| 128 pp::FileRef_Dev file_ref(file_system, "/file_read_write_setlength"); | 128 pp::FileRef_Dev file_ref(file_system, "/file_read_write_setlength"); |
| 129 int32_t rv = file_system.Open(1024, callback); | 129 int32_t rv = file_system.Open(1024, callback); |
| 130 if (rv == PP_ERROR_WOULDBLOCK) | 130 if (rv == PP_ERROR_WOULDBLOCK) |
| 131 rv = callback.WaitForResult(); | 131 rv = callback.WaitForResult(); |
| 132 if (rv != PP_OK) | 132 if (rv != PP_OK) |
| 133 return ReportError("FileSystem::Open", rv); | 133 return ReportError("FileSystem::Open", rv); |
| 134 | 134 |
| 135 pp::FileIO_Dev file_io; | 135 pp::FileIO_Dev file_io(instance_); |
| 136 rv = file_io.Open(file_ref, | 136 rv = file_io.Open(file_ref, |
| 137 PP_FILEOPENFLAG_CREATE | | 137 PP_FILEOPENFLAG_CREATE | |
| 138 PP_FILEOPENFLAG_READ | | 138 PP_FILEOPENFLAG_READ | |
| 139 PP_FILEOPENFLAG_WRITE, | 139 PP_FILEOPENFLAG_WRITE, |
| 140 callback); | 140 callback); |
| 141 if (rv == PP_ERROR_WOULDBLOCK) | 141 if (rv == PP_ERROR_WOULDBLOCK) |
| 142 rv = callback.WaitForResult(); | 142 rv = callback.WaitForResult(); |
| 143 if (rv != PP_OK) | 143 if (rv != PP_OK) |
| 144 return ReportError("FileIO::Open", rv); | 144 return ReportError("FileIO::Open", rv); |
| 145 | 145 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 TestCompletionCallback callback; | 239 TestCompletionCallback callback; |
| 240 | 240 |
| 241 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 241 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| 242 int32_t rv = file_system.Open(1024, callback); | 242 int32_t rv = file_system.Open(1024, callback); |
| 243 if (rv == PP_ERROR_WOULDBLOCK) | 243 if (rv == PP_ERROR_WOULDBLOCK) |
| 244 rv = callback.WaitForResult(); | 244 rv = callback.WaitForResult(); |
| 245 if (rv != PP_OK) | 245 if (rv != PP_OK) |
| 246 return ReportError("FileSystem::Open", rv); | 246 return ReportError("FileSystem::Open", rv); |
| 247 | 247 |
| 248 pp::FileRef_Dev file_ref(file_system, "/file_touch"); | 248 pp::FileRef_Dev file_ref(file_system, "/file_touch"); |
| 249 pp::FileIO_Dev file_io; | 249 pp::FileIO_Dev file_io(instance_); |
| 250 rv = file_io.Open(file_ref, | 250 rv = file_io.Open(file_ref, |
| 251 PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, | 251 PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, |
| 252 callback); | 252 callback); |
| 253 if (rv == PP_ERROR_WOULDBLOCK) | 253 if (rv == PP_ERROR_WOULDBLOCK) |
| 254 rv = callback.WaitForResult(); | 254 rv = callback.WaitForResult(); |
| 255 if (rv != PP_OK) | 255 if (rv != PP_OK) |
| 256 return ReportError("FileIO::Open", rv); | 256 return ReportError("FileIO::Open", rv); |
| 257 | 257 |
| 258 // Write some data to have a non-zero file size. | 258 // Write some data to have a non-zero file size. |
| 259 rv = file_io.Write(0, "test", 4, callback); | 259 rv = file_io.Write(0, "test", 4, callback); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 302 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| 303 pp::FileRef_Dev file_ref(file_system, "/file_abort_calls"); | 303 pp::FileRef_Dev file_ref(file_system, "/file_abort_calls"); |
| 304 int32_t rv = file_system.Open(1024, callback); | 304 int32_t rv = file_system.Open(1024, callback); |
| 305 if (rv == PP_ERROR_WOULDBLOCK) | 305 if (rv == PP_ERROR_WOULDBLOCK) |
| 306 rv = callback.WaitForResult(); | 306 rv = callback.WaitForResult(); |
| 307 if (rv != PP_OK) | 307 if (rv != PP_OK) |
| 308 return ReportError("FileSystem::Open", rv); | 308 return ReportError("FileSystem::Open", rv); |
| 309 | 309 |
| 310 // First, create a file which to do ops on. | 310 // First, create a file which to do ops on. |
| 311 { | 311 { |
| 312 pp::FileIO_Dev file_io; | 312 pp::FileIO_Dev file_io(instance_); |
| 313 rv = file_io.Open(file_ref, | 313 rv = file_io.Open(file_ref, |
| 314 PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, | 314 PP_FILEOPENFLAG_CREATE | PP_FILEOPENFLAG_WRITE, |
| 315 callback); | 315 callback); |
| 316 if (rv == PP_ERROR_WOULDBLOCK) | 316 if (rv == PP_ERROR_WOULDBLOCK) |
| 317 rv = callback.WaitForResult(); | 317 rv = callback.WaitForResult(); |
| 318 if (rv != PP_OK) | 318 if (rv != PP_OK) |
| 319 return ReportError("FileIO::Open", rv); | 319 return ReportError("FileIO::Open", rv); |
| 320 | 320 |
| 321 // N.B.: Should write at least 3 bytes. | 321 // N.B.: Should write at least 3 bytes. |
| 322 rv = WriteEntireBuffer(&file_io, 0, "foobarbazquux"); | 322 rv = WriteEntireBuffer(&file_io, 0, "foobarbazquux"); |
| 323 if (rv != PP_OK) | 323 if (rv != PP_OK) |
| 324 return ReportError("FileIO::Write", rv); | 324 return ReportError("FileIO::Write", rv); |
| 325 } | 325 } |
| 326 | 326 |
| 327 // Abort |Open()|. | 327 // Abort |Open()|. |
| 328 { | 328 { |
| 329 callback.reset_run_count(); | 329 callback.reset_run_count(); |
| 330 rv = pp::FileIO_Dev().Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 330 rv = pp::FileIO_Dev(instance_) |
| 331 .Open(file_ref, PP_FILEOPENFLAG_READ,callback); |
| 331 if (callback.run_count() > 0) | 332 if (callback.run_count() > 0) |
| 332 return "FileIO::Open ran callback synchronously."; | 333 return "FileIO::Open ran callback synchronously."; |
| 333 if (rv == PP_ERROR_WOULDBLOCK) { | 334 if (rv == PP_ERROR_WOULDBLOCK) { |
| 334 rv = callback.WaitForResult(); | 335 rv = callback.WaitForResult(); |
| 335 if (rv != PP_ERROR_ABORTED) | 336 if (rv != PP_ERROR_ABORTED) |
| 336 return "FileIO::Open not aborted."; | 337 return "FileIO::Open not aborted."; |
| 337 } else if (rv != PP_OK) { | 338 } else if (rv != PP_OK) { |
| 338 return ReportError("FileIO::Open", rv); | 339 return ReportError("FileIO::Open", rv); |
| 339 } | 340 } |
| 340 } | 341 } |
| 341 | 342 |
| 342 // Abort |Query()|. | 343 // Abort |Query()|. |
| 343 { | 344 { |
| 344 PP_FileInfo_Dev info = { 0 }; | 345 PP_FileInfo_Dev info = { 0 }; |
| 345 { | 346 { |
| 346 pp::FileIO_Dev file_io; | 347 pp::FileIO_Dev file_io(instance_); |
| 347 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 348 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); |
| 348 if (rv == PP_ERROR_WOULDBLOCK) | 349 if (rv == PP_ERROR_WOULDBLOCK) |
| 349 rv = callback.WaitForResult(); | 350 rv = callback.WaitForResult(); |
| 350 if (rv != PP_OK) | 351 if (rv != PP_OK) |
| 351 return ReportError("FileIO::Open", rv); | 352 return ReportError("FileIO::Open", rv); |
| 352 | 353 |
| 353 callback.reset_run_count(); | 354 callback.reset_run_count(); |
| 354 rv = file_io.Query(&info, callback); | 355 rv = file_io.Query(&info, callback); |
| 355 } // Destroy |file_io|. | 356 } // Destroy |file_io|. |
| 356 if (rv == PP_ERROR_WOULDBLOCK) { | 357 if (rv == PP_ERROR_WOULDBLOCK) { |
| 357 // Save a copy and make sure |info| doesn't get written to. | 358 // Save a copy and make sure |info| doesn't get written to. |
| 358 PP_FileInfo_Dev info_copy; | 359 PP_FileInfo_Dev info_copy; |
| 359 memcpy(&info_copy, &info, sizeof(info)); | 360 memcpy(&info_copy, &info, sizeof(info)); |
| 360 rv = callback.WaitForResult(); | 361 rv = callback.WaitForResult(); |
| 361 if (rv != PP_ERROR_ABORTED) | 362 if (rv != PP_ERROR_ABORTED) |
| 362 return "FileIO::Query not aborted."; | 363 return "FileIO::Query not aborted."; |
| 363 if (memcmp(&info_copy, &info, sizeof(info)) != 0) | 364 if (memcmp(&info_copy, &info, sizeof(info)) != 0) |
| 364 return "FileIO::Query wrote data after resource destruction."; | 365 return "FileIO::Query wrote data after resource destruction."; |
| 365 } else if (rv != PP_OK) { | 366 } else if (rv != PP_OK) { |
| 366 return ReportError("FileIO::Query", rv); | 367 return ReportError("FileIO::Query", rv); |
| 367 } | 368 } |
| 368 } | 369 } |
| 369 | 370 |
| 370 // Abort |Touch()|. | 371 // Abort |Touch()|. |
| 371 { | 372 { |
| 372 { | 373 { |
| 373 pp::FileIO_Dev file_io; | 374 pp::FileIO_Dev file_io(instance_); |
| 374 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE, callback); | 375 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_WRITE, callback); |
| 375 if (rv == PP_ERROR_WOULDBLOCK) | 376 if (rv == PP_ERROR_WOULDBLOCK) |
| 376 rv = callback.WaitForResult(); | 377 rv = callback.WaitForResult(); |
| 377 if (rv != PP_OK) | 378 if (rv != PP_OK) |
| 378 return ReportError("FileIO::Open", rv); | 379 return ReportError("FileIO::Open", rv); |
| 379 | 380 |
| 380 callback.reset_run_count(); | 381 callback.reset_run_count(); |
| 381 rv = file_io.Touch(0, 0, callback); | 382 rv = file_io.Touch(0, 0, callback); |
| 382 } // Destroy |file_io|. | 383 } // Destroy |file_io|. |
| 383 if (rv == PP_ERROR_WOULDBLOCK) { | 384 if (rv == PP_ERROR_WOULDBLOCK) { |
| 384 rv = callback.WaitForResult(); | 385 rv = callback.WaitForResult(); |
| 385 if (rv != PP_ERROR_ABORTED) | 386 if (rv != PP_ERROR_ABORTED) |
| 386 return "FileIO::Touch not aborted."; | 387 return "FileIO::Touch not aborted."; |
| 387 } else if (rv != PP_OK) { | 388 } else if (rv != PP_OK) { |
| 388 return ReportError("FileIO::Touch", rv); | 389 return ReportError("FileIO::Touch", rv); |
| 389 } | 390 } |
| 390 } | 391 } |
| 391 | 392 |
| 392 // Abort |Read()|. | 393 // Abort |Read()|. |
| 393 { | 394 { |
| 394 char buf[3] = { 0 }; | 395 char buf[3] = { 0 }; |
| 395 { | 396 { |
| 396 pp::FileIO_Dev file_io; | 397 pp::FileIO_Dev file_io(instance_); |
| 397 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 398 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); |
| 398 if (rv == PP_ERROR_WOULDBLOCK) | 399 if (rv == PP_ERROR_WOULDBLOCK) |
| 399 rv = callback.WaitForResult(); | 400 rv = callback.WaitForResult(); |
| 400 if (rv != PP_OK) | 401 if (rv != PP_OK) |
| 401 return ReportError("FileIO::Open", rv); | 402 return ReportError("FileIO::Open", rv); |
| 402 | 403 |
| 403 callback.reset_run_count(); | 404 callback.reset_run_count(); |
| 404 rv = file_io.Read(0, buf, sizeof(buf), callback); | 405 rv = file_io.Read(0, buf, sizeof(buf), callback); |
| 405 } // Destroy |file_io|. | 406 } // Destroy |file_io|. |
| 406 if (rv == PP_ERROR_WOULDBLOCK) { | 407 if (rv == PP_ERROR_WOULDBLOCK) { |
| 407 // Save a copy and make sure |buf| doesn't get written to. | 408 // Save a copy and make sure |buf| doesn't get written to. |
| 408 char buf_copy[3]; | 409 char buf_copy[3]; |
| 409 memcpy(&buf_copy, &buf, sizeof(buf)); | 410 memcpy(&buf_copy, &buf, sizeof(buf)); |
| 410 rv = callback.WaitForResult(); | 411 rv = callback.WaitForResult(); |
| 411 if (rv != PP_ERROR_ABORTED) | 412 if (rv != PP_ERROR_ABORTED) |
| 412 return "FileIO::Read not aborted."; | 413 return "FileIO::Read not aborted."; |
| 413 if (memcmp(&buf_copy, &buf, sizeof(buf)) != 0) | 414 if (memcmp(&buf_copy, &buf, sizeof(buf)) != 0) |
| 414 return "FileIO::Read wrote data after resource destruction."; | 415 return "FileIO::Read wrote data after resource destruction."; |
| 415 } else if (rv != PP_OK) { | 416 } else if (rv != PP_OK) { |
| 416 return ReportError("FileIO::Read", rv); | 417 return ReportError("FileIO::Read", rv); |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 | 420 |
| 420 // Abort |Write()|. | 421 // Abort |Write()|. |
| 421 { | 422 { |
| 422 char buf[3] = { 0 }; | 423 char buf[3] = { 0 }; |
| 423 { | 424 { |
| 424 pp::FileIO_Dev file_io; | 425 pp::FileIO_Dev file_io(instance_); |
| 425 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 426 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); |
| 426 if (rv == PP_ERROR_WOULDBLOCK) | 427 if (rv == PP_ERROR_WOULDBLOCK) |
| 427 rv = callback.WaitForResult(); | 428 rv = callback.WaitForResult(); |
| 428 if (rv != PP_OK) | 429 if (rv != PP_OK) |
| 429 return ReportError("FileIO::Open", rv); | 430 return ReportError("FileIO::Open", rv); |
| 430 | 431 |
| 431 callback.reset_run_count(); | 432 callback.reset_run_count(); |
| 432 rv = file_io.Write(0, buf, sizeof(buf), callback); | 433 rv = file_io.Write(0, buf, sizeof(buf), callback); |
| 433 } // Destroy |file_io|. | 434 } // Destroy |file_io|. |
| 434 if (rv == PP_ERROR_WOULDBLOCK) { | 435 if (rv == PP_ERROR_WOULDBLOCK) { |
| 435 rv = callback.WaitForResult(); | 436 rv = callback.WaitForResult(); |
| 436 if (rv != PP_ERROR_ABORTED) | 437 if (rv != PP_ERROR_ABORTED) |
| 437 return "FileIO::Write not aborted."; | 438 return "FileIO::Write not aborted."; |
| 438 } else if (rv != PP_OK) { | 439 } else if (rv != PP_OK) { |
| 439 return ReportError("FileIO::Write", rv); | 440 return ReportError("FileIO::Write", rv); |
| 440 } | 441 } |
| 441 } | 442 } |
| 442 | 443 |
| 443 // Abort |SetLength()|. | 444 // Abort |SetLength()|. |
| 444 { | 445 { |
| 445 { | 446 { |
| 446 pp::FileIO_Dev file_io; | 447 pp::FileIO_Dev file_io(instance_); |
| 447 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 448 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); |
| 448 if (rv == PP_ERROR_WOULDBLOCK) | 449 if (rv == PP_ERROR_WOULDBLOCK) |
| 449 rv = callback.WaitForResult(); | 450 rv = callback.WaitForResult(); |
| 450 if (rv != PP_OK) | 451 if (rv != PP_OK) |
| 451 return ReportError("FileIO::Open", rv); | 452 return ReportError("FileIO::Open", rv); |
| 452 | 453 |
| 453 callback.reset_run_count(); | 454 callback.reset_run_count(); |
| 454 rv = file_io.SetLength(3, callback); | 455 rv = file_io.SetLength(3, callback); |
| 455 } // Destroy |file_io|. | 456 } // Destroy |file_io|. |
| 456 if (rv == PP_ERROR_WOULDBLOCK) { | 457 if (rv == PP_ERROR_WOULDBLOCK) { |
| 457 rv = callback.WaitForResult(); | 458 rv = callback.WaitForResult(); |
| 458 if (rv != PP_ERROR_ABORTED) | 459 if (rv != PP_ERROR_ABORTED) |
| 459 return "FileIO::SetLength not aborted."; | 460 return "FileIO::SetLength not aborted."; |
| 460 } else if (rv != PP_OK) { | 461 } else if (rv != PP_OK) { |
| 461 return ReportError("FileIO::SetLength", rv); | 462 return ReportError("FileIO::SetLength", rv); |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 | 465 |
| 465 // Abort |Flush()|. | 466 // Abort |Flush()|. |
| 466 { | 467 { |
| 467 { | 468 { |
| 468 pp::FileIO_Dev file_io; | 469 pp::FileIO_Dev file_io(instance_); |
| 469 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); | 470 rv = file_io.Open(file_ref, PP_FILEOPENFLAG_READ, callback); |
| 470 if (rv == PP_ERROR_WOULDBLOCK) | 471 if (rv == PP_ERROR_WOULDBLOCK) |
| 471 rv = callback.WaitForResult(); | 472 rv = callback.WaitForResult(); |
| 472 if (rv != PP_OK) | 473 if (rv != PP_OK) |
| 473 return ReportError("FileIO::Open", rv); | 474 return ReportError("FileIO::Open", rv); |
| 474 | 475 |
| 475 callback.reset_run_count(); | 476 callback.reset_run_count(); |
| 476 rv = file_io.Flush(callback); | 477 rv = file_io.Flush(callback); |
| 477 } // Destroy |file_io|. | 478 } // Destroy |file_io|. |
| 478 if (rv == PP_ERROR_WOULDBLOCK) { | 479 if (rv == PP_ERROR_WOULDBLOCK) { |
| 479 rv = callback.WaitForResult(); | 480 rv = callback.WaitForResult(); |
| 480 if (rv != PP_ERROR_ABORTED) | 481 if (rv != PP_ERROR_ABORTED) |
| 481 return "FileIO::Flush not aborted."; | 482 return "FileIO::Flush not aborted."; |
| 482 } else if (rv != PP_OK) { | 483 } else if (rv != PP_OK) { |
| 483 return ReportError("FileIO::Flush", rv); | 484 return ReportError("FileIO::Flush", rv); |
| 484 } | 485 } |
| 485 } | 486 } |
| 486 | 487 |
| 487 // TODO(viettrungluu): Also test that Close() aborts callbacks. | 488 // TODO(viettrungluu): Also test that Close() aborts callbacks. |
| 488 // crbug.com/69457 | 489 // crbug.com/69457 |
| 489 | 490 |
| 490 PASS(); | 491 PASS(); |
| 491 } | 492 } |
| 492 | 493 |
| 493 // TODO(viettrungluu): Test Close(). crbug.com/69457 | 494 // TODO(viettrungluu): Test Close(). crbug.com/69457 |
| OLD | NEW |