| 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_ref.h" | 5 #include "ppapi/tests/test_file_ref.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 return method_name + " returned '" + returned_result + "'; '" + | 37 return method_name + " returned '" + returned_result + "'; '" + |
| 38 expected_result + "' expected."; | 38 expected_result + "' expected."; |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 bool TestFileRef::Init() { | 43 bool TestFileRef::Init() { |
| 44 return InitTestingInterface() && EnsureRunningOverHTTP(); | 44 return InitTestingInterface() && EnsureRunningOverHTTP(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TestFileRef::RunTest() { | 47 void TestFileRef::RunTests(const std::string& filter) { |
| 48 RUN_TEST_FORCEASYNC_AND_NOT(Create); | 48 RUN_TEST_FORCEASYNC_AND_NOT(Create, filter); |
| 49 RUN_TEST_FORCEASYNC_AND_NOT(GetFileSystemType); | 49 RUN_TEST_FORCEASYNC_AND_NOT(GetFileSystemType, filter); |
| 50 RUN_TEST_FORCEASYNC_AND_NOT(GetName); | 50 RUN_TEST_FORCEASYNC_AND_NOT(GetName, filter); |
| 51 RUN_TEST_FORCEASYNC_AND_NOT(GetPath); | 51 RUN_TEST_FORCEASYNC_AND_NOT(GetPath, filter); |
| 52 RUN_TEST_FORCEASYNC_AND_NOT(GetParent); | 52 RUN_TEST_FORCEASYNC_AND_NOT(GetParent, filter); |
| 53 RUN_TEST_FORCEASYNC_AND_NOT(MakeDirectory); | 53 RUN_TEST_FORCEASYNC_AND_NOT(MakeDirectory, filter); |
| 54 RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile); | 54 RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter); |
| 55 RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory); | 55 RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter); |
| 56 RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory); | 56 RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter); |
| 57 } | 57 } |
| 58 | 58 |
| 59 std::string TestFileRef::TestCreate() { | 59 std::string TestFileRef::TestCreate() { |
| 60 std::vector<std::string> invalid_paths; | 60 std::vector<std::string> invalid_paths; |
| 61 invalid_paths.push_back("invalid_path"); // no '/' at the first character | 61 invalid_paths.push_back("invalid_path"); // no '/' at the first character |
| 62 invalid_paths.push_back(""); // empty path | 62 invalid_paths.push_back(""); // empty path |
| 63 // The following are directory traversal checks | 63 // The following are directory traversal checks |
| 64 invalid_paths.push_back(".."); | 64 invalid_paths.push_back(".."); |
| 65 invalid_paths.push_back("/../invalid_path"); | 65 invalid_paths.push_back("/../invalid_path"); |
| 66 invalid_paths.push_back("/../../invalid_path"); | 66 invalid_paths.push_back("/../../invalid_path"); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 if (rv == PP_OK_COMPLETIONPENDING) { | 663 if (rv == PP_OK_COMPLETIONPENDING) { |
| 664 rv = callback.WaitForResult(); | 664 rv = callback.WaitForResult(); |
| 665 if (rv != PP_ERROR_ABORTED) | 665 if (rv != PP_ERROR_ABORTED) |
| 666 return "FileSystem::Rename not aborted."; | 666 return "FileSystem::Rename not aborted."; |
| 667 } else if (rv != PP_OK) { | 667 } else if (rv != PP_OK) { |
| 668 return ReportError("FileSystem::Rename", rv); | 668 return ReportError("FileSystem::Rename", rv); |
| 669 } | 669 } |
| 670 | 670 |
| 671 PASS(); | 671 PASS(); |
| 672 } | 672 } |
| OLD | NEW |