| 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_system.h" | 5 #include "ppapi/tests/test_file_system.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/cpp/file_system.h" | 10 #include "ppapi/cpp/file_system.h" |
| 11 #include "ppapi/tests/test_utils.h" | 11 #include "ppapi/tests/test_utils.h" |
| 12 #include "ppapi/tests/testing_instance.h" | 12 #include "ppapi/tests/testing_instance.h" |
| 13 | 13 |
| 14 REGISTER_TEST_CASE(FileSystem); | 14 REGISTER_TEST_CASE(FileSystem); |
| 15 | 15 |
| 16 bool TestFileSystem::Init() { | 16 bool TestFileSystem::Init() { |
| 17 return InitTestingInterface() && EnsureRunningOverHTTP(); | 17 return InitTestingInterface() && EnsureRunningOverHTTP(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void TestFileSystem::RunTest() { | 20 void TestFileSystem::RunTests(const std::string& filter) { |
| 21 RUN_TEST_FORCEASYNC_AND_NOT(Open); | 21 RUN_TEST_FORCEASYNC_AND_NOT(Open, filter); |
| 22 RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens); | 22 RUN_TEST_FORCEASYNC_AND_NOT(MultipleOpens, filter); |
| 23 } | 23 } |
| 24 | 24 |
| 25 std::string TestFileSystem::TestOpen() { | 25 std::string TestFileSystem::TestOpen() { |
| 26 TestCompletionCallback callback(instance_->pp_instance(), force_async_); | 26 TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
| 27 | 27 |
| 28 // Open. | 28 // Open. |
| 29 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); | 29 pp::FileSystem file_system(instance_, PP_FILESYSTEMTYPE_LOCALTEMPORARY); |
| 30 int32_t rv = file_system.Open(1024, callback); | 30 int32_t rv = file_system.Open(1024, callback); |
| 31 if (rv == PP_OK_COMPLETIONPENDING) | 31 if (rv == PP_OK_COMPLETIONPENDING) |
| 32 rv = callback.WaitForResult(); | 32 rv = callback.WaitForResult(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 int32_t rv_3 = file_system.Open(1024, callback_3); | 81 int32_t rv_3 = file_system.Open(1024, callback_3); |
| 82 if (force_async_ && rv_3 != PP_OK_COMPLETIONPENDING) | 82 if (force_async_ && rv_3 != PP_OK_COMPLETIONPENDING) |
| 83 return ReportError("FileSystem::Open3 force_async", rv_3); | 83 return ReportError("FileSystem::Open3 force_async", rv_3); |
| 84 if (rv_3 == PP_OK_COMPLETIONPENDING) | 84 if (rv_3 == PP_OK_COMPLETIONPENDING) |
| 85 rv_3 = callback_3.WaitForResult(); | 85 rv_3 = callback_3.WaitForResult(); |
| 86 if (rv_3 == PP_OK) | 86 if (rv_3 == PP_OK) |
| 87 return "FileSystem::Open3 should not allow multiple opens."; | 87 return "FileSystem::Open3 should not allow multiple opens."; |
| 88 | 88 |
| 89 PASS(); | 89 PASS(); |
| 90 } | 90 } |
| OLD | NEW |