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

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

Issue 113363004: PPAPI: Add new PPB_FileRef.MakeDirectory to support exclusive operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 11 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/ppapi_messages.h ('k') | ppapi/tests/test_file_ref.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::string TestFileIO::TestOpenDirectory() { 289 std::string TestFileIO::TestOpenDirectory() {
290 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); 290 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
291 291
292 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); 292 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY);
293 callback.WaitForResult(file_system.Open(1024, callback.GetCallback())); 293 callback.WaitForResult(file_system.Open(1024, callback.GetCallback()));
294 CHECK_CALLBACK_BEHAVIOR(callback); 294 CHECK_CALLBACK_BEHAVIOR(callback);
295 ASSERT_EQ(PP_OK, callback.result()); 295 ASSERT_EQ(PP_OK, callback.result());
296 296
297 // Make a directory. 297 // Make a directory.
298 pp::FileRef dir_ref(file_system, "/test_dir_open_directory"); 298 pp::FileRef dir_ref(file_system, "/test_dir_open_directory");
299 callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); 299 callback.WaitForResult(dir_ref.MakeDirectory(
300 PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback()));
300 CHECK_CALLBACK_BEHAVIOR(callback); 301 CHECK_CALLBACK_BEHAVIOR(callback);
301 ASSERT_EQ(PP_OK, callback.result()); 302 ASSERT_EQ(PP_OK, callback.result());
302 303
303 // Open the directory. This is expected to fail since directories cannot be 304 // Open the directory. This is expected to fail since directories cannot be
304 // opened. 305 // opened.
305 pp::FileIO file_io(instance_); 306 pp::FileIO file_io(instance_);
306 callback.WaitForResult(file_io.Open(dir_ref, PP_FILEOPENFLAG_READ, 307 callback.WaitForResult(file_io.Open(dir_ref, PP_FILEOPENFLAG_READ,
307 callback.GetCallback())); 308 callback.GetCallback()));
308 CHECK_CALLBACK_BEHAVIOR(callback); 309 CHECK_CALLBACK_BEHAVIOR(callback);
309 ASSERT_EQ(PP_ERROR_NOTAFILE, callback.result()); 310 ASSERT_EQ(PP_ERROR_NOTAFILE, callback.result());
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if ((invalid_combination && callback.result() == PP_OK) || 1343 if ((invalid_combination && callback.result() == PP_OK) ||
1343 (!invalid_combination && 1344 (!invalid_combination &&
1344 ((callback.result() == PP_OK) != create_if_doesnt_exist))) { 1345 ((callback.result() == PP_OK) != create_if_doesnt_exist))) {
1345 return ReportOpenError(open_flags); 1346 return ReportOpenError(open_flags);
1346 } 1347 }
1347 1348
1348 return std::string(); 1349 return std::string();
1349 } 1350 }
1350 1351
1351 // TODO(viettrungluu): Test Close(). crbug.com/69457 1352 // TODO(viettrungluu): Test Close(). crbug.com/69457
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/tests/test_file_ref.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698