| OLD | NEW |
| 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 Loading... |
| 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( | 299 callback.WaitForResult(dir_ref.MakeDirectory(callback.GetCallback())); |
| 300 PP_MAKEDIRECTORYFLAG_NONE, callback.GetCallback())); | |
| 301 CHECK_CALLBACK_BEHAVIOR(callback); | 300 CHECK_CALLBACK_BEHAVIOR(callback); |
| 302 ASSERT_EQ(PP_OK, callback.result()); | 301 ASSERT_EQ(PP_OK, callback.result()); |
| 303 | 302 |
| 304 // Open the directory. This is expected to fail since directories cannot be | 303 // Open the directory. This is expected to fail since directories cannot be |
| 305 // opened. | 304 // opened. |
| 306 pp::FileIO file_io(instance_); | 305 pp::FileIO file_io(instance_); |
| 307 callback.WaitForResult(file_io.Open(dir_ref, PP_FILEOPENFLAG_READ, | 306 callback.WaitForResult(file_io.Open(dir_ref, PP_FILEOPENFLAG_READ, |
| 308 callback.GetCallback())); | 307 callback.GetCallback())); |
| 309 CHECK_CALLBACK_BEHAVIOR(callback); | 308 CHECK_CALLBACK_BEHAVIOR(callback); |
| 310 ASSERT_EQ(PP_ERROR_NOTAFILE, callback.result()); | 309 ASSERT_EQ(PP_ERROR_NOTAFILE, callback.result()); |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 if ((invalid_combination && callback.result() == PP_OK) || | 1342 if ((invalid_combination && callback.result() == PP_OK) || |
| 1344 (!invalid_combination && | 1343 (!invalid_combination && |
| 1345 ((callback.result() == PP_OK) != create_if_doesnt_exist))) { | 1344 ((callback.result() == PP_OK) != create_if_doesnt_exist))) { |
| 1346 return ReportOpenError(open_flags); | 1345 return ReportOpenError(open_flags); |
| 1347 } | 1346 } |
| 1348 | 1347 |
| 1349 return std::string(); | 1348 return std::string(); |
| 1350 } | 1349 } |
| 1351 | 1350 |
| 1352 // TODO(viettrungluu): Test Close(). crbug.com/69457 | 1351 // TODO(viettrungluu): Test Close(). crbug.com/69457 |
| OLD | NEW |