Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: ppapi/tests/test_file_ref.cc

Issue 6519057: Implement proxying for FileRef and FileChooser.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix ppapi tests to account for query change Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/serialized_var.cc ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 if (rv == PP_ERROR_WOULDBLOCK) { 373 if (rv == PP_ERROR_WOULDBLOCK) {
374 rv = callback.WaitForResult(); 374 rv = callback.WaitForResult();
375 if (rv != PP_ERROR_ABORTED) 375 if (rv != PP_ERROR_ABORTED)
376 return "FileSystem::Touch not aborted."; 376 return "FileSystem::Touch not aborted.";
377 } else if (rv != PP_OK) { 377 } else if (rv != PP_OK) {
378 return ReportError("FileSystem::Touch", rv); 378 return ReportError("FileSystem::Touch", rv);
379 } 379 }
380 380
381 // Query. 381 // Query.
382 PP_FileInfo_Dev info; 382 PP_FileInfo_Dev info;
383 rv = file_ref.Query(&info, callback); 383 rv = file_io.Query(&info, callback);
384 if (rv == PP_ERROR_WOULDBLOCK) 384 if (rv == PP_ERROR_WOULDBLOCK)
385 rv = callback.WaitForResult(); 385 rv = callback.WaitForResult();
386 if (rv != PP_OK) 386 if (rv != PP_OK)
387 return ReportError("FileSystem::Query", rv); 387 return ReportError("FileSystem::Query", rv);
388 388
389 if ((info.size != 4) || 389 if ((info.size != 4) ||
390 (info.type != PP_FILETYPE_REGULAR) || 390 (info.type != PP_FILETYPE_REGULAR) ||
391 (info.system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) || 391 (info.system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) ||
392 (info.last_access_time != last_access_time) || 392 (info.last_access_time != last_access_time) ||
393 (info.last_modified_time != last_modified_time)) 393 (info.last_modified_time != last_modified_time))
394 return "FileSystem::Query() has returned bad data."; 394 return "FileSystem::Query() has returned bad data.";
395 395
396 // Cancellation test. 396 // Cancellation test.
397 // TODO(viettrungluu): this test causes a bunch of LOG(WARNING)s; investigate. 397 // TODO(viettrungluu): this test causes a bunch of LOG(WARNING)s; investigate.
398 callback.reset_run_count(); 398 callback.reset_run_count();
399 // TODO(viettrungluu): check |info| for late writes. 399 // TODO(viettrungluu): check |info| for late writes.
400 rv = pp::FileRef_Dev(file_system, "/file_touch").Query(&info, callback); 400 rv = pp::FileRef_Dev(file_system, "/file_touch").Touch(
401 last_access_time, last_modified_time, callback);
401 if (callback.run_count() > 0) 402 if (callback.run_count() > 0)
402 return "FileSystem::Query ran callback synchronously."; 403 return "FileSystem::Touch ran callback synchronously.";
403 if (rv == PP_ERROR_WOULDBLOCK) { 404 if (rv == PP_ERROR_WOULDBLOCK) {
404 rv = callback.WaitForResult(); 405 rv = callback.WaitForResult();
405 if (rv != PP_ERROR_ABORTED) 406 if (rv != PP_ERROR_ABORTED)
406 return "FileSystem::Query not aborted."; 407 return "FileSystem::Touch not aborted.";
407 } else if (rv != PP_OK) { 408 } else if (rv != PP_OK) {
408 return ReportError("FileSystem::Query", rv); 409 return ReportError("FileSystem::Touch", rv);
409 } 410 }
410 411
411 PASS(); 412 PASS();
412 } 413 }
413 414
414 std::string TestFileRef::TestDeleteFileAndDirectory() { 415 std::string TestFileRef::TestDeleteFileAndDirectory() {
415 TestCompletionCallback callback(instance_->pp_instance()); 416 TestCompletionCallback callback(instance_->pp_instance());
416 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); 417 pp::FileSystem_Dev file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
417 int32_t rv = file_system.Open(1024, callback); 418 int32_t rv = file_system.Open(1024, callback);
418 if (rv == PP_ERROR_WOULDBLOCK) 419 if (rv == PP_ERROR_WOULDBLOCK)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (rv == PP_ERROR_WOULDBLOCK) { 570 if (rv == PP_ERROR_WOULDBLOCK) {
570 rv = callback.WaitForResult(); 571 rv = callback.WaitForResult();
571 if (rv != PP_ERROR_ABORTED) 572 if (rv != PP_ERROR_ABORTED)
572 return "FileSystem::Rename not aborted."; 573 return "FileSystem::Rename not aborted.";
573 } else if (rv != PP_OK) { 574 } else if (rv != PP_OK) {
574 return ReportError("FileSystem::Rename", rv); 575 return ReportError("FileSystem::Rename", rv);
575 } 576 }
576 577
577 PASS(); 578 PASS();
578 } 579 }
OLDNEW
« no previous file with comments | « ppapi/proxy/serialized_var.cc ('k') | webkit/plugins/ppapi/ppb_file_ref_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698