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

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

Issue 6596026: Don't allow multiple opens for Pepper FileSystem. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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/ppb_file_system_proxy.cc ('k') | ppapi/tests/test_file_system.h » ('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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_system_proxy.cc ('k') | ppapi/tests/test_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698