| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter); | 78 RUN_TEST_FORCEASYNC_AND_NOT(QueryAndTouchFile, filter); |
| 79 RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter); | 79 RUN_TEST_FORCEASYNC_AND_NOT(DeleteFileAndDirectory, filter); |
| 80 RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter); | 80 RUN_TEST_FORCEASYNC_AND_NOT(RenameFileAndDirectory, filter); |
| 81 RUN_CALLBACK_TEST(TestFileRef, Query, filter); | 81 RUN_CALLBACK_TEST(TestFileRef, Query, filter); |
| 82 RUN_TEST_FORCEASYNC_AND_NOT(FileNameEscaping, filter); | 82 RUN_TEST_FORCEASYNC_AND_NOT(FileNameEscaping, filter); |
| 83 } | 83 } |
| 84 | 84 |
| 85 std::string TestFileRef::TestCreate() { | 85 std::string TestFileRef::TestCreate() { |
| 86 std::vector<std::string> invalid_paths; | 86 std::vector<std::string> invalid_paths; |
| 87 invalid_paths.push_back("invalid_path"); // no '/' at the first character | 87 invalid_paths.push_back("invalid_path"); // no '/' at the first character |
| 88 invalid_paths.push_back(""); // empty path | 88 invalid_paths.push_back(std::string()); // empty path |
| 89 // The following are directory traversal checks | 89 // The following are directory traversal checks |
| 90 invalid_paths.push_back(".."); | 90 invalid_paths.push_back(".."); |
| 91 invalid_paths.push_back("/../invalid_path"); | 91 invalid_paths.push_back("/../invalid_path"); |
| 92 invalid_paths.push_back("/../../invalid_path"); | 92 invalid_paths.push_back("/../../invalid_path"); |
| 93 invalid_paths.push_back("/invalid/../../path"); | 93 invalid_paths.push_back("/invalid/../../path"); |
| 94 const size_t num_invalid_paths = invalid_paths.size(); | 94 const size_t num_invalid_paths = invalid_paths.size(); |
| 95 | 95 |
| 96 pp::FileSystem file_system_pers( | 96 pp::FileSystem file_system_pers( |
| 97 instance_, PP_FILESYSTEMTYPE_LOCALPERSISTENT); | 97 instance_, PP_FILESYSTEMTYPE_LOCALPERSISTENT); |
| 98 pp::FileSystem file_system_temp( | 98 pp::FileSystem file_system_temp( |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 if (entries.empty()) | 791 if (entries.empty()) |
| 792 return "Entry was not found."; | 792 return "Entry was not found."; |
| 793 if (entries.size() != 1) | 793 if (entries.size() != 1) |
| 794 return "Directory had too many entries."; | 794 return "Directory had too many entries."; |
| 795 if (entries.front().file_ref().GetName().AsString() != kTerribleName) | 795 if (entries.front().file_ref().GetName().AsString() != kTerribleName) |
| 796 return "Entry name did not match."; | 796 return "Entry name did not match."; |
| 797 } | 797 } |
| 798 | 798 |
| 799 PASS(); | 799 PASS(); |
| 800 } | 800 } |
| OLD | NEW |